Skip to content

Commit dd2e36e

Browse files
phillipwoodgitster
authored andcommitted
rebase -i: fix numbering in squash message
Commit e12a7ef ("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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 15ef693 commit dd2e36e

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

sequencer.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1387,13 +1387,13 @@ static int update_squash_messages(enum todo_command command,
13871387
unlink(rebase_path_fixup_msg());
13881388
strbuf_addf(&buf, "\n%c ", comment_line_char);
13891389
strbuf_addf(&buf, _("This is the commit message #%d:"),
1390-
++opts->current_fixup_count);
1390+
++opts->current_fixup_count + 1);
13911391
strbuf_addstr(&buf, "\n\n");
13921392
strbuf_addstr(&buf, body);
13931393
} else if (command == TODO_FIXUP) {
13941394
strbuf_addf(&buf, "\n%c ", comment_line_char);
13951395
strbuf_addf(&buf, _("The commit message #%d will be skipped:"),
1396-
++opts->current_fixup_count);
1396+
++opts->current_fixup_count + 1);
13971397
strbuf_addstr(&buf, "\n\n");
13981398
strbuf_add_commented_lines(&buf, body, strlen(body));
13991399
} else

t/t3418-rebase-continue.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,13 +128,15 @@ test_expect_success '--skip after failed fixup cleans commit message' '
128128
: The first squash was skipped, therefore: &&
129129
git show HEAD >out &&
130130
test_i18ngrep "# This is a combination of 2 commits" out &&
131+
test_i18ngrep "# This is the commit message #2:" out &&
131132
132133
(test_set_editor "$PWD/copy-editor.sh" && git rebase --skip) &&
133134
git show HEAD >out &&
134135
test_i18ngrep ! "# This is a combination" out &&
135136
136137
: Final squash failed, but there was still a squash &&
137-
test_i18ngrep "# This is a combination of 2 commits" .git/copy.txt
138+
test_i18ngrep "# This is a combination of 2 commits" .git/copy.txt &&
139+
test_i18ngrep "# This is the commit message #2:" .git/copy.txt
138140
'
139141

140142
test_expect_success 'setup rerere database' '

0 commit comments

Comments
 (0)