summaryrefslogtreecommitdiff
path: root/builtin/log.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2015-08-20 21:36:49 (GMT)
committerJunio C Hamano <gitster@pobox.com>2015-08-20 22:03:57 (GMT)
commitc7eaf8b4c3085fd2db2a47b83b828e363dcf5fd0 (patch)
tree6a0dfec737f6e28818593b4bef40b85306f02b80 /builtin/log.c
parentb130c706ecfaa370259a476c2b754fb4c4a1a180 (diff)
downloadgit-c7eaf8b4c3085fd2db2a47b83b828e363dcf5fd0.zip
git-c7eaf8b4c3085fd2db2a47b83b828e363dcf5fd0.tar.gz
git-c7eaf8b4c3085fd2db2a47b83b828e363dcf5fd0.tar.bz2
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>
Diffstat (limited to 'builtin/log.c')
-rw-r--r--builtin/log.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/builtin/log.c b/builtin/log.c
index 8651105..e37c27a 100644
--- a/builtin/log.c
+++ b/builtin/log.c
@@ -633,6 +633,10 @@ static void log_setup_revisions_tweak(struct rev_info *rev,
if (DIFF_OPT_TST(&rev->diffopt, DEFAULT_FOLLOW_RENAMES) &&
rev->prune_data.nr == 1)
DIFF_OPT_SET(&rev->diffopt, FOLLOW_RENAMES);
+
+ /* Turn --cc/-c into -p --cc/-c when -p was not given */
+ if (!rev->diffopt.output_format && rev->combine_merges)
+ rev->diffopt.output_format = DIFF_FORMAT_PATCH;
}
int cmd_log(int argc, const char **argv, const char *prefix)