Skip to content

Commit 82dee41

Browse files
committed
log: show merge commit when --cc is given
We defaulted to ignoring merge diffs because long long ago, in a galaxy far away, we didn't have a great way to show the diffs. The whole "--cc" option goes back to January '06 and commit d8f4790 ("diff-tree --cc: denser combined diff output for a merge commit"). And before that option - so for about 8 months - we had no good way to show the diffs of merges in a good dense way. So the whole "don't show diffs for merges by default" actually made a lot of sense originally, because our merge diffs were not very useful. And this was carried forward to this day. "git log --cc" still ignores merge commits, and you need to say "git log -m --cc" to view a sensible rendition of merge and non-merge commits, even with the previous change to make "--cc" imply "-p". Teach "git log" that "--cc" means the user wants to see interesting changes in merge commits by turning "-m" on. Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent c7eaf8b commit 82dee41

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

builtin/log.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -637,6 +637,10 @@ static void log_setup_revisions_tweak(struct rev_info *rev,
637637
/* Turn --cc/-c into -p --cc/-c when -p was not given */
638638
if (!rev->diffopt.output_format && rev->combine_merges)
639639
rev->diffopt.output_format = DIFF_FORMAT_PATCH;
640+
641+
/* Turn -m on when --cc/-c was given */
642+
if (rev->combine_merges)
643+
rev->ignore_merges = 0;
640644
}
641645

642646
int cmd_log(int argc, const char **argv, const char *prefix)

0 commit comments

Comments
 (0)