show --first-parent/-m: do not default to --cc
Given that "git show" always shows some diff and does not walk the history
by default, it is natural to expect "git show --first-parent" to show the
difference between the given commit and its first parent. It also would
be natural, given that "--cc" is the default, "git show -m" to show
pairwise difference from each of the parents.
We however always defaulted to --cc and there was no way to turn it off.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
diff --git a/builtin-log.c b/builtin-log.c
index ab5f60c..4dd6d2c 100644
--- a/builtin-log.c
+++ b/builtin-log.c
@@ -329,6 +329,15 @@
static void show_rev_tweak_rev(struct rev_info *rev, struct setup_revision_opt *opt)
{
+ if (rev->ignore_merges) {
+ /* There was no "-m" on the command line */
+ rev->ignore_merges = 0;
+ if (!rev->first_parent_only && !rev->combine_merges) {
+ /* No "--first-parent", "-c", nor "--cc" */
+ rev->combine_merges = 1;
+ rev->dense_combined_merges = 1;
+ }
+ }
if (!rev->diffopt.output_format)
rev->diffopt.output_format = DIFF_FORMAT_PATCH;
}
@@ -347,10 +356,7 @@
init_revisions(&rev, prefix);
rev.diff = 1;
- rev.combine_merges = 1;
- rev.dense_combined_merges = 1;
rev.always_show_header = 1;
- rev.ignore_merges = 0;
rev.no_walk = 1;
memset(&opt, 0, sizeof(opt));
opt.def = "HEAD";