range-diff: suppress the diff headers
When showing the diff between corresponding patches of the two branch versions, we have to make up a fake filename to run the diff machinery. That filename does not carry any meaningful information, hence tbdiff suppresses it. So we should, too. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Johannes Schindelin committed
Aug 13, 2018 at 04:33 UTC
1cdde296a5d3b0fd17a3fcd7a0869550b064fdce
3 files changed
+6
-1
builtin/range-diff.c
+1
@@ -33,6 +33,7 @@ int cmd_range_diff(int argc, const char **argv, const char *prefix)
33
34
diff_setup(&diffopt);
35
diffopt.output_format = DIFF_FORMAT_PATCH;
36
+ diffopt.flags.suppress_diff_headers = 1;
37
diffopt.output_prefix = output_prefix_cb;
38
strbuf_addstr(&four_spaces, " ");
39
diffopt.output_prefix_data = &four_spaces;
diff.c
+4
-1
@@ -3395,13 +3395,16 @@ static void builtin_diff(const char *name_a,
3395
memset(&xpp, 0, sizeof(xpp));
3396
memset(&xecfg, 0, sizeof(xecfg));
3397
memset(&ecbdata, 0, sizeof(ecbdata));
3398
+ if (o->flags.suppress_diff_headers)
3399
+ lbl[0] = NULL;
3400
ecbdata.label_path = lbl;
3401
ecbdata.color_diff = want_color(o->use_color);
3402
ecbdata.ws_rule = whitespace_rule(name_b);
3403
if (ecbdata.ws_rule & WS_BLANK_AT_EOF)
3404
check_blank_at_eof(&mf1, &mf2, &ecbdata);
3405
ecbdata.opt = o;
3404
- ecbdata.header = header.len ? &header : NULL;
3406
+ if (header.len && !o->flags.suppress_diff_headers)
3407
+ ecbdata.header = &header;
3408
xpp.flags = o->xdl_opts;
3409
xpp.anchors = o->anchors;
3410
xpp.anchors_nr = o->anchors_nr;
diff.h
+1
@@ -94,6 +94,7 @@ struct diff_flags {
94
unsigned funccontext:1;
95
unsigned default_follow_renames:1;
96
unsigned stat_with_summary:1;
97
+ unsigned suppress_diff_headers:1;
98
};
99
100
static inline void diff_flags_or(struct diff_flags *a,