We previously relied on the localized versions of
# This is a combination of <N> commits
(which we write into the commit messages during fixup/squash chains)
to contain <N> as ASCII.
This is not true in general, and certainly not in GETTEXT_POISON, as
demonstrated by the regression test we just introduced in t3418.
Signed-off-by: Johannes Schindelin <[email protected]>
---
sequencer.c | 36 ++++++++++++++++++++++--------------
1 file changed, 22 insertions(+), 14 deletions(-)
diff --git a/sequencer.c b/sequencer.c
index 667f35ebdff..dc482e76a28 100644
--- a/sequencer.c
+++ b/sequencer.c
@@ -1343,19 +1343,18 @@ static int update_squash_messages(enum todo_command
command,
eol = strchrnul(buf.buf, '\n');
if (buf.buf[0] != comment_line_char ||
(p += strcspn(p, "0123456789\n")) == eol)
- return error(_("unexpected 1st line of squash message:"
- "\n\n\t%.*s"),
- (int)(eol - buf.buf), buf.buf);
- count = strtol(p, NULL, 10);
-
- if (count < 1)
- return error(_("invalid 1st line of squash message:\n"
- "\n\t%.*s"),
- (int)(eol - buf.buf), buf.buf);
+ count = -1;
+ else
+ count = strtol(p, NULL, 10);
strbuf_addf(&header, "%c ", comment_line_char);
- strbuf_addf(&header,
- _("This is a combination of %d commits."), ++count);
+ if (count < 1)
+ strbuf_addf(&header, _("This is a combination of "
+ "several commits."));
+ else
+ strbuf_addf(&header,
+ _("This is a combination of %d commits."),
+ ++count);
strbuf_splice(&buf, 0, eol - buf.buf, header.buf, header.len);
strbuf_release(&header);
} else {
@@ -1398,13 +1397,22 @@ static int update_squash_messages(enum todo_command
command,
if (command == TODO_SQUASH) {
unlink(rebase_path_fixup_msg());
strbuf_addf(&buf, "\n%c ", comment_line_char);
- strbuf_addf(&buf, _("This is the commit message #%d:"), count);
+ if (count < 2)
+ strbuf_addf(&buf, _("This is the next commit "
+ "message:"));
+ else
+ strbuf_addf(&buf, _("This is the commit message #%d:"),
+ count);
strbuf_addstr(&buf, "\n\n");
strbuf_addstr(&buf, body);
} else if (command == TODO_FIXUP) {
strbuf_addf(&buf, "\n%c ", comment_line_char);
- strbuf_addf(&buf, _("The commit message #%d will be skipped:"),
- count);
+ if (count < 2)
+ strbuf_addf(&buf, _("The next commit message will be "
+ "skipped:"));
+ else
+ strbuf_addf(&buf, _("The commit message #%d will be "
+ "skipped:"), count);
strbuf_addstr(&buf, "\n\n");
strbuf_add_commented_lines(&buf, body, strlen(body));
} else
--
2.17.0.windows.1.15.gaa56ade3205