Skip to content

Commit d8981c3

Browse files
committed
format-patch: do not let its diff-options affect --range-diff
Stop leaking how the primary output of format-patch is customized to the range-diff machinery and instead let the latter use its own "reasonable default", in order to correct the breakage introduced by a517079 ("Merge branch 'ab/range-diff-no-patch'", 2018-11-18) on the 'master' front. "git format-patch --range-diff..." without any weird diff option started to include the "range-diff --stat" output, which is rather useless right now, that made the whole thing unusable and this is probably the least disruptive way to whip the codebase into a shippable shape. We may want to later make the range-diff driven by format-patch more configurable, but that would have to wait until we have a good design. Signed-off-by: Junio C Hamano <[email protected]>
1 parent 7068cbc commit d8981c3

File tree

5 files changed

+17
-3
lines changed

5 files changed

+17
-3
lines changed

Documentation/git-format-patch.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,11 @@ feeding the result to `git send-email`.
250250
feature/v2`), or a revision range if the two versions of the series are
251251
disjoint (for example `git format-patch --cover-letter
252252
--range-diff=feature/v1~3..feature/v1 -3 feature/v2`).
253+
+
254+
Note that diff options passed to the command affect how the primary
255+
product of `format-patch` is generated, and they are not passed to
256+
the underlying `range-diff` machinery used to generate the cover-letter
257+
material (this may change in the future).
253258

254259
--creation-factor=<percent>::
255260
Used with `--range-diff`, tweak the heuristic which matches up commits

builtin/log.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1096,7 +1096,7 @@ static void make_cover_letter(struct rev_info *rev, int use_stdout,
10961096
if (rev->rdiff1) {
10971097
fprintf_ln(rev->diffopt.file, "%s", rev->rdiff_title);
10981098
show_range_diff(rev->rdiff1, rev->rdiff2,
1099-
rev->creation_factor, 1, &rev->diffopt);
1099+
rev->creation_factor, 1, NULL);
11001100
}
11011101
}
11021102

log-tree.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -762,7 +762,7 @@ void show_log(struct rev_info *opt)
762762
next_commentary_block(opt, NULL);
763763
fprintf_ln(opt->diffopt.file, "%s", opt->rdiff_title);
764764
show_range_diff(opt->rdiff1, opt->rdiff2,
765-
opt->creation_factor, 1, &opt->diffopt);
765+
opt->creation_factor, 1, NULL);
766766

767767
memcpy(&diff_queued_diff, &dq, sizeof(diff_queued_diff));
768768
}

range-diff.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,11 @@ int show_range_diff(const char *range1, const char *range2,
460460
struct diff_options opts;
461461
struct strbuf indent = STRBUF_INIT;
462462

463-
memcpy(&opts, diffopt, sizeof(opts));
463+
if (diffopt)
464+
memcpy(&opts, diffopt, sizeof(opts));
465+
else
466+
diff_setup(&opts);
467+
464468
if (!opts.output_format)
465469
opts.output_format = DIFF_FORMAT_PATCH;
466470
opts.flags.suppress_diff_headers = 1;

range-diff.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@
55

66
#define RANGE_DIFF_CREATION_FACTOR_DEFAULT 60
77

8+
/*
9+
* Compare series of commmits in RANGE1 and RANGE2, and emit to the
10+
* standard output. NULL can be passed to DIFFOPT to use the built-in
11+
* default.
12+
*/
813
int show_range_diff(const char *range1, const char *range2,
914
int creation_factor, int dual_color,
1015
struct diff_options *diffopt);

0 commit comments

Comments
 (0)