mirror of
https://github.com/git/git.git
synced 2025-01-25 00:43:41 +08:00
rebase -i: fix numbering in squash message
Commit e12a7ef597
("rebase -i: Handle "combination of <n> commits" with
GETTEXT_POISON", 2018-04-27) changed the way that individual commit
messages are labelled when squashing commits together. In doing so a
regression was introduced where the numbering of the messages is off by
one. This commit fixes that and adds a test for the numbering.
Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
15ef69314d
commit
dd2e36ebac
@ -1387,13 +1387,13 @@ static int update_squash_messages(enum todo_command command,
|
||||
unlink(rebase_path_fixup_msg());
|
||||
strbuf_addf(&buf, "\n%c ", comment_line_char);
|
||||
strbuf_addf(&buf, _("This is the commit message #%d:"),
|
||||
++opts->current_fixup_count);
|
||||
++opts->current_fixup_count + 1);
|
||||
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:"),
|
||||
++opts->current_fixup_count);
|
||||
++opts->current_fixup_count + 1);
|
||||
strbuf_addstr(&buf, "\n\n");
|
||||
strbuf_add_commented_lines(&buf, body, strlen(body));
|
||||
} else
|
||||
|
@ -128,13 +128,15 @@ test_expect_success '--skip after failed fixup cleans commit message' '
|
||||
: The first squash was skipped, therefore: &&
|
||||
git show HEAD >out &&
|
||||
test_i18ngrep "# This is a combination of 2 commits" out &&
|
||||
test_i18ngrep "# This is the commit message #2:" out &&
|
||||
|
||||
(test_set_editor "$PWD/copy-editor.sh" && git rebase --skip) &&
|
||||
git show HEAD >out &&
|
||||
test_i18ngrep ! "# This is a combination" out &&
|
||||
|
||||
: Final squash failed, but there was still a squash &&
|
||||
test_i18ngrep "# This is a combination of 2 commits" .git/copy.txt
|
||||
test_i18ngrep "# This is a combination of 2 commits" .git/copy.txt &&
|
||||
test_i18ngrep "# This is the commit message #2:" .git/copy.txt
|
||||
'
|
||||
|
||||
test_expect_success 'setup rerere database' '
|
||||
|
Loading…
Reference in New Issue
Block a user