diff options
author | Eric Sunshine <sunshine@sunshineco.com> | 2018-07-22 05:57:15 -0400 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2018-08-14 14:27:04 -0700 |
commit | 4ee99689410cf7275f21833779da89626eb6edd6 (patch) | |
tree | 9985b1b15df4c1dee5c97af5c3c47fd90a12ade0 | |
parent | format-patch: extend --range-diff to accept revision range (diff) | |
download | tgif-4ee99689410cf7275f21833779da89626eb6edd6.tar.xz |
format-patch: teach --range-diff to respect -v/--reroll-count
The --range-diff option announces the embedded range-diff generically
as "Range-diff:", however, we can do better when --reroll-count is
specified by emitting "Range-diff against v{n}:" instead.
Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r-- | builtin/log.c | 7 | ||||
-rw-r--r-- | revision.h | 1 |
2 files changed, 7 insertions, 1 deletions
diff --git a/builtin/log.c b/builtin/log.c index fa54090b02..0dc17fe325 100644 --- a/builtin/log.c +++ b/builtin/log.c @@ -1092,7 +1092,7 @@ static void make_cover_letter(struct rev_info *rev, int use_stdout, } if (rev->rdiff1) { - fprintf_ln(rev->diffopt.file, "%s", _("Range-diff:")); + fprintf_ln(rev->diffopt.file, "%s", rev->rdiff_title); show_range_diff(rev->rdiff1, rev->rdiff2, rev->creation_factor, 1, &rev->diffopt); } @@ -1497,6 +1497,7 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix) const char *rdiff_prev = NULL; struct strbuf rdiff1 = STRBUF_INIT; struct strbuf rdiff2 = STRBUF_INIT; + struct strbuf rdiff_title = STRBUF_INIT; const struct option builtin_format_patch_options[] = { { OPTION_CALLBACK, 'n', "numbered", &numbered, NULL, @@ -1816,6 +1817,9 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix) rev.rdiff1 = rdiff1.buf; rev.rdiff2 = rdiff2.buf; rev.creation_factor = RANGE_DIFF_CREATION_FACTOR_DEFAULT; + rev.rdiff_title = diff_title(&rdiff_title, reroll_count, + _("Range-diff:"), + _("Range-diff against v%d:")); } if (!signature) { @@ -1943,6 +1947,7 @@ done: strbuf_release(&idiff_title); strbuf_release(&rdiff1); strbuf_release(&rdiff2); + strbuf_release(&rdiff_title); return 0; } diff --git a/revision.h b/revision.h index 01fd7e2630..7106b89e9e 100644 --- a/revision.h +++ b/revision.h @@ -222,6 +222,7 @@ struct rev_info { const char *rdiff1; const char *rdiff2; int creation_factor; + const char *rdiff_title; /* commit counts */ int count_left; |