diff options
author | Junio C Hamano <gitster@pobox.com> | 2018-12-01 21:41:42 +0900 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2018-12-01 21:41:42 +0900 |
commit | d32fa3c6f7f441c7c9f16d0661ce041e6f9a3439 (patch) | |
tree | 7337c0018c55bb91e000b78c8c2b8e973e71e070 | |
parent | Merge branch 'ja/i18n-fix' (diff) | |
parent | format-patch: do not let its diff-options affect --range-diff (diff) | |
download | tgif-d32fa3c6f7f441c7c9f16d0661ce041e6f9a3439.tar.xz |
Merge branch 'jc/format-patch-range-diff-fix'
"git format-patch --range-diff" by mistake passed the diff options
used to generate the primary output of the command to the
range-diff machinery, which caused the range-diff in the cover
letter to include fairly useless "--stat" output. This has been
corrected by forcing a non-customizable default formatting options
on the range-diff machinery when driven by format-patch.
* jc/format-patch-range-diff-fix:
format-patch: do not let its diff-options affect --range-diff
-rw-r--r-- | Documentation/git-format-patch.txt | 5 | ||||
-rw-r--r-- | builtin/log.c | 2 | ||||
-rw-r--r-- | log-tree.c | 2 | ||||
-rw-r--r-- | range-diff.c | 6 | ||||
-rw-r--r-- | range-diff.h | 5 |
5 files changed, 17 insertions, 3 deletions
diff --git a/Documentation/git-format-patch.txt b/Documentation/git-format-patch.txt index aba4c5febe..27304428a1 100644 --- a/Documentation/git-format-patch.txt +++ b/Documentation/git-format-patch.txt @@ -250,6 +250,11 @@ feeding the result to `git send-email`. feature/v2`), or a revision range if the two versions of the series are disjoint (for example `git format-patch --cover-letter --range-diff=feature/v1~3..feature/v1 -3 feature/v2`). ++ +Note that diff options passed to the command affect how the primary +product of `format-patch` is generated, and they are not passed to +the underlying `range-diff` machinery used to generate the cover-letter +material (this may change in the future). --creation-factor=<percent>:: Used with `--range-diff`, tweak the heuristic which matches up commits diff --git a/builtin/log.c b/builtin/log.c index 0fe6f9ba1e..5ac18e2848 100644 --- a/builtin/log.c +++ b/builtin/log.c @@ -1096,7 +1096,7 @@ static void make_cover_letter(struct rev_info *rev, int use_stdout, if (rev->rdiff1) { fprintf_ln(rev->diffopt.file, "%s", rev->rdiff_title); show_range_diff(rev->rdiff1, rev->rdiff2, - rev->creation_factor, 1, &rev->diffopt); + rev->creation_factor, 1, NULL); } } diff --git a/log-tree.c b/log-tree.c index 7a83e99250..b243779a0b 100644 --- a/log-tree.c +++ b/log-tree.c @@ -762,7 +762,7 @@ void show_log(struct rev_info *opt) next_commentary_block(opt, NULL); fprintf_ln(opt->diffopt.file, "%s", opt->rdiff_title); show_range_diff(opt->rdiff1, opt->rdiff2, - opt->creation_factor, 1, &opt->diffopt); + opt->creation_factor, 1, NULL); memcpy(&diff_queued_diff, &dq, sizeof(diff_queued_diff)); } diff --git a/range-diff.c b/range-diff.c index 767af8c5bb..48b0e1b4ce 100644 --- a/range-diff.c +++ b/range-diff.c @@ -460,7 +460,11 @@ int show_range_diff(const char *range1, const char *range2, struct diff_options opts; struct strbuf indent = STRBUF_INIT; - memcpy(&opts, diffopt, sizeof(opts)); + if (diffopt) + memcpy(&opts, diffopt, sizeof(opts)); + else + diff_setup(&opts); + if (!opts.output_format) opts.output_format = DIFF_FORMAT_PATCH; opts.flags.suppress_diff_headers = 1; diff --git a/range-diff.h b/range-diff.h index 190593f0c7..08a50b6e98 100644 --- a/range-diff.h +++ b/range-diff.h @@ -5,6 +5,11 @@ #define RANGE_DIFF_CREATION_FACTOR_DEFAULT 60 +/* + * Compare series of commmits in RANGE1 and RANGE2, and emit to the + * standard output. NULL can be passed to DIFFOPT to use the built-in + * default. + */ int show_range_diff(const char *range1, const char *range2, int creation_factor, int dual_color, struct diff_options *diffopt); |