summaryrefslogtreecommitdiff
path: root/builtin-log.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2010-03-09 00:22:54 -0800
committerJunio C Hamano <gitster@pobox.com>2010-03-09 01:11:19 -0800
commit2bf6587349e31b582dae47954b1a334052230e28 (patch)
tree4cd84f9e1fdde96fcbdad2cec1c4996542140879 /builtin-log.c
parentb44900599710c700c1bf164d3753eb7f8eb6c18a (diff)
downloadgit-2bf6587349e31b582dae47954b1a334052230e28.tar.gz
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>
Diffstat (limited to 'builtin-log.c')
-rw-r--r--builtin-log.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/builtin-log.c b/builtin-log.c
index ab5f60c9e2..4dd6d2c449 100644
--- a/builtin-log.c
+++ b/builtin-log.c
@@ -329,6 +329,15 @@ static int show_tree_object(const unsigned char *sha1,
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 @@ int cmd_show(int argc, const char **argv, const char *prefix)
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";