summaryrefslogtreecommitdiff
path: root/combine-diff.c
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2006-06-27 22:08:19 (GMT)
committerJunio C Hamano <junkio@cox.net>2006-06-27 22:33:40 (GMT)
commit3969cf7db1a13a78f3b7a36d8c1084bbe0a53459 (patch)
tree2b16523d7552997a7c3f562a4f2bffbc207a926c /combine-diff.c
parenta959e0dc16907c4dc123cfac7bd22c636064a638 (diff)
downloadgit-3969cf7db1a13a78f3b7a36d8c1084bbe0a53459.zip
git-3969cf7db1a13a78f3b7a36d8c1084bbe0a53459.tar.gz
git-3969cf7db1a13a78f3b7a36d8c1084bbe0a53459.tar.bz2
Fix some more diff options changes.
This fixes various problems in the new diff options code. - Fix --cc/-c --patch; it showed two-tree diff used internally. - Use "---\n" only where it matters -- that is, use it immediately after the commit log text when we show a commit log and something else before the patch text. - Do not output spurious extra "\n"; have an extra newline after the commit log text always when we have diff output and we are not doing oneline. - When running a pickaxe you need to go recursive. Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'combine-diff.c')
-rw-r--r--combine-diff.c24
1 files changed, 15 insertions, 9 deletions
diff --git a/combine-diff.c b/combine-diff.c
index 39fb10c..7178b25 100644
--- a/combine-diff.c
+++ b/combine-diff.c
@@ -835,31 +835,33 @@ void diff_tree_combined(const unsigned char *sha1,
struct diff_options *opt = &rev->diffopt;
struct diff_options diffopts;
struct combine_diff_path *p, *paths = NULL;
- int i, num_paths;
+ int i, num_paths, needsep, show_log_first;
diffopts = *opt;
- diffopts.output_format &= ~(DIFF_FORMAT_RAW | DIFF_FORMAT_DIFFSTAT);
+ diffopts.output_format = DIFF_FORMAT_NO_OUTPUT;
diffopts.recursive = 1;
+ show_log_first = rev->loginfo;
+ needsep = 0;
/* find set of paths that everybody touches */
for (i = 0; i < num_parent; i++) {
/* show stat against the first parent even
* when doing combined diff.
*/
if (i == 0 && opt->output_format & DIFF_FORMAT_DIFFSTAT)
- diffopts.output_format |= DIFF_FORMAT_DIFFSTAT;
+ diffopts.output_format = DIFF_FORMAT_DIFFSTAT;
else
- diffopts.output_format |= DIFF_FORMAT_NO_OUTPUT;
+ diffopts.output_format = DIFF_FORMAT_NO_OUTPUT;
diff_tree_sha1(parent[i], sha1, "", &diffopts);
diffcore_std(&diffopts);
paths = intersect_paths(paths, i, num_parent);
- if (opt->output_format & DIFF_FORMAT_DIFFSTAT && rev->loginfo)
+ if (show_log_first && i == 0) {
show_log(rev, opt->msg_sep);
-
+ if (rev->verbose_header && opt->output_format)
+ putchar(opt->line_termination);
+ }
diff_flush(&diffopts);
- if (opt->output_format & DIFF_FORMAT_DIFFSTAT)
- putchar('\n');
}
/* find out surviving paths */
@@ -875,9 +877,13 @@ void diff_tree_combined(const unsigned char *sha1,
if (p->len)
show_raw_diff(p, num_parent, rev);
}
- putchar(opt->line_termination);
+ needsep = 1;
}
+ else if (opt->output_format & DIFF_FORMAT_DIFFSTAT)
+ needsep = 1;
if (opt->output_format & DIFF_FORMAT_PATCH) {
+ if (needsep)
+ putchar(opt->line_termination);
for (p = paths; p; p = p->next) {
if (p->len)
show_patch_diff(p, num_parent, dense,