summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 1f5a892)
raw | patch | inline | side by side (parent: 1f5a892)
author | Junio C Hamano <gitster@pobox.com> | |
Thu, 18 Sep 2008 07:32:37 +0000 (00:32 -0700) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Thu, 18 Sep 2008 17:49:03 +0000 (10:49 -0700) |
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>
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>
builtin-diff-files.c | patch | blob | history | |
builtin-diff.c | patch | blob | history |
diff --git a/builtin-diff-files.c b/builtin-diff-files.c
index 9bf10bb37e2f56ec2a10239d7419db8fbb641745..2b578c714d36c600107f03b454ed8241dc2d4f19 100644 (file)
--- a/builtin-diff-files.c
+++ b/builtin-diff-files.c
3 < rev.max_count)
usage(diff_files_usage);
- if (rev.max_count == -1 &&
+ /*
+ * "diff-files --base -p" should not combine merges because it
+ * was not asked to. "diff-files -c -p" should not densify
+ * (the user should ask with "diff-files --cc" explicitly).
+ */
+ if (rev.max_count == -1 && !rev.combine_merges &&
(rev.diffopt.output_format & DIFF_FORMAT_PATCH))
rev.combine_merges = rev.dense_combined_merges = 1;
diff --git a/builtin-diff.c b/builtin-diff.c
index 037c3039a43d198f228fbc64e46d85d4170c1329..d5fe775fc135c0905cabec6731104009ca3bfef3 100644 (file)
--- 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;