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>
This commit is contained in:
committed by
Junio C Hamano
parent
5e242e63d0
commit
1cdde296a5
@@ -33,6 +33,7 @@ int cmd_range_diff(int argc, const char **argv, const char *prefix)
|
|||||||
|
|
||||||
diff_setup(&diffopt);
|
diff_setup(&diffopt);
|
||||||
diffopt.output_format = DIFF_FORMAT_PATCH;
|
diffopt.output_format = DIFF_FORMAT_PATCH;
|
||||||
|
diffopt.flags.suppress_diff_headers = 1;
|
||||||
diffopt.output_prefix = output_prefix_cb;
|
diffopt.output_prefix = output_prefix_cb;
|
||||||
strbuf_addstr(&four_spaces, " ");
|
strbuf_addstr(&four_spaces, " ");
|
||||||
diffopt.output_prefix_data = &four_spaces;
|
diffopt.output_prefix_data = &four_spaces;
|
||||||
|
|||||||
5
diff.c
5
diff.c
@@ -3395,13 +3395,16 @@ static void builtin_diff(const char *name_a,
|
|||||||
memset(&xpp, 0, sizeof(xpp));
|
memset(&xpp, 0, sizeof(xpp));
|
||||||
memset(&xecfg, 0, sizeof(xecfg));
|
memset(&xecfg, 0, sizeof(xecfg));
|
||||||
memset(&ecbdata, 0, sizeof(ecbdata));
|
memset(&ecbdata, 0, sizeof(ecbdata));
|
||||||
|
if (o->flags.suppress_diff_headers)
|
||||||
|
lbl[0] = NULL;
|
||||||
ecbdata.label_path = lbl;
|
ecbdata.label_path = lbl;
|
||||||
ecbdata.color_diff = want_color(o->use_color);
|
ecbdata.color_diff = want_color(o->use_color);
|
||||||
ecbdata.ws_rule = whitespace_rule(name_b);
|
ecbdata.ws_rule = whitespace_rule(name_b);
|
||||||
if (ecbdata.ws_rule & WS_BLANK_AT_EOF)
|
if (ecbdata.ws_rule & WS_BLANK_AT_EOF)
|
||||||
check_blank_at_eof(&mf1, &mf2, &ecbdata);
|
check_blank_at_eof(&mf1, &mf2, &ecbdata);
|
||||||
ecbdata.opt = o;
|
ecbdata.opt = o;
|
||||||
ecbdata.header = header.len ? &header : NULL;
|
if (header.len && !o->flags.suppress_diff_headers)
|
||||||
|
ecbdata.header = &header;
|
||||||
xpp.flags = o->xdl_opts;
|
xpp.flags = o->xdl_opts;
|
||||||
xpp.anchors = o->anchors;
|
xpp.anchors = o->anchors;
|
||||||
xpp.anchors_nr = o->anchors_nr;
|
xpp.anchors_nr = o->anchors_nr;
|
||||||
|
|||||||
1
diff.h
1
diff.h
@@ -94,6 +94,7 @@ struct diff_flags {
|
|||||||
unsigned funccontext:1;
|
unsigned funccontext:1;
|
||||||
unsigned default_follow_renames:1;
|
unsigned default_follow_renames:1;
|
||||||
unsigned stat_with_summary:1;
|
unsigned stat_with_summary:1;
|
||||||
|
unsigned suppress_diff_headers:1;
|
||||||
};
|
};
|
||||||
|
|
||||||
static inline void diff_flags_or(struct diff_flags *a,
|
static inline void diff_flags_or(struct diff_flags *a,
|
||||||
|
|||||||
Reference in New Issue
Block a user