Skip to content

Commit c7eaf8b

Browse files
committed
log: when --cc is given, default to -p unless told otherwise
The "--cc" option to "git log" is clearly a request to show some sort of combined diff (be it --patch or --raw), but traditionally we required the command line to explicitly ask for "git log -p --cc". Teach the command line parser to treat a lone "--cc" as if the user specified "-p --cc". Formats that do ask for other forms of diff output, e.g. "log --raw --cc", are not overriden. Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent b130c70 commit c7eaf8b

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
@@ -633,6 +633,10 @@ static void log_setup_revisions_tweak(struct rev_info *rev,
633633
if (DIFF_OPT_TST(&rev->diffopt, DEFAULT_FOLLOW_RENAMES) &&
634634
rev->prune_data.nr == 1)
635635
DIFF_OPT_SET(&rev->diffopt, FOLLOW_RENAMES);
636+
637+
/* Turn --cc/-c into -p --cc/-c when -p was not given */
638+
if (!rev->diffopt.output_format && rev->combine_merges)
639+
rev->diffopt.output_format = DIFF_FORMAT_PATCH;
636640
}
637641

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

0 commit comments

Comments
 (0)