summaryrefslogtreecommitdiff
path: root/log-tree.c
diff options
context:
space:
mode:
authorZheNing Hu <adlternative@gmail.com>2021-03-23 11:12:25 (GMT)
committerJunio C Hamano <gitster@pobox.com>2021-03-23 19:49:47 (GMT)
commitdb91988aa102d48af1c1203d8cc2d01240df7365 (patch)
tree7cceefdf74570b5b592793f527f5e45db21c7a47 /log-tree.c
parent90917373cd21f60ccd2636e067a0c2685d29d0d5 (diff)
downloadgit-db91988aa102d48af1c1203d8cc2d01240df7365.zip
git-db91988aa102d48af1c1203d8cc2d01240df7365.tar.gz
git-db91988aa102d48af1c1203d8cc2d01240df7365.tar.bz2
format-patch: allow a non-integral version numbers
The `-v<n>` option of `format-patch` can give nothing but an integral iteration number to patches in a series.  Some people, however, prefer to mark a new iteration with only a small fixup with a non integral iteration number (e.g. an "oops, that was wrong" fix-up patch for v4 iteration may be labeled as "v4.1"). Allow `format-patch` to take such a non-integral iteration number. `<n>` can be any string, such as '3.1' or '4rev2'. In the case where it is a non-integral value, the "Range-diff" and "Interdiff" headers will not include the previous version. Signed-off-by: ZheNing Hu <adlternative@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'log-tree.c')
-rw-r--r--log-tree.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/log-tree.c b/log-tree.c
index 4531ceb..f3178a6 100644
--- a/log-tree.c
+++ b/log-tree.c
@@ -369,8 +369,14 @@ void fmt_output_subject(struct strbuf *filename,
int start_len = filename->len;
int max_len = start_len + info->patch_name_max - (strlen(suffix) + 1);
- if (0 < info->reroll_count)
- strbuf_addf(filename, "v%d-", info->reroll_count);
+ if (info->reroll_count) {
+ struct strbuf temp = STRBUF_INIT;
+
+ strbuf_addf(&temp, "v%s", info->reroll_count);
+ format_sanitized_subject(filename, temp.buf, temp.len);
+ strbuf_addstr(filename, "-");
+ strbuf_release(&temp);
+ }
strbuf_addf(filename, "%04d-%s", nr, subject);
if (max_len < filename->len)