summaryrefslogtreecommitdiff
path: root/builtin-diff.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2008-09-18 00:32:37 -0700
committerJunio C Hamano <gitster@pobox.com>2008-09-18 10:49:03 -0700
commit903e09a3ecca8941b32bae08b821545941591348 (patch)
treed91e053a26f3f295e05c3f6e2228d6bb8f5a57ec /builtin-diff.c
parent1f5a892e5209be329dda316edb0341066d62e3eb (diff)
downloadgit-903e09a3ecca8941b32bae08b821545941591348.tar.gz
diff/diff-files: do not use --cc too aggressively
Textual diff output for unmerged paths was too eager to give condensed combined diff. Even though "diff -c" (and "diff-files -c -p") is a request to view combined diff without condensing (otherwise the user would have explicitly asked for --cc, not -c), we showed "--cc" output anyway. 0fe7c1d (built-in diff: assorted updates, 2006-04-29) claimed to be careful about doing this, but its breakage was hidden because back then "git diff" was still a shell script that did not use the codepath it introduced fully. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin-diff.c')
-rw-r--r--builtin-diff.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/builtin-diff.c b/builtin-diff.c
index 037c3039a4..d5fe775fc1 100644
--- a/builtin-diff.c
+++ b/builtin-diff.c
@@ -223,7 +223,13 @@ static int builtin_diff_files(struct rev_info *revs, int argc, const char **argv
argv++; argc--;
}
- if (revs->max_count == -1 &&
+ /*
+ * "diff --base" should not combine merges because it was not
+ * asked to. "diff -c" should not densify (if the user wants
+ * dense one, --cc can be explicitly asked for, or just rely
+ * on the default).
+ */
+ if (revs->max_count == -1 && !revs->combine_merges &&
(revs->diffopt.output_format & DIFF_FORMAT_PATCH))
revs->combine_merges = revs->dense_combined_merges = 1;