mirror of
https://github.com/git/git
synced 2024-08-26 19:19:18 +00:00
Merge branch 'pw/rebase-i-squash-number-fix'
When "git rebase -i" is told to squash two or more commits into one, it labeled the log message for each commit with its number. It correctly called the first one "1st commit", but the next one was "commit #1", which was off-by-one. This has been corrected. * pw/rebase-i-squash-number-fix: rebase -i: fix numbering in squash message
This commit is contained in:
commit
36fd1e843b
|
@ -1552,13 +1552,13 @@ static int update_squash_messages(enum todo_command command,
|
||||||
unlink(rebase_path_fixup_msg());
|
unlink(rebase_path_fixup_msg());
|
||||||
strbuf_addf(&buf, "\n%c ", comment_line_char);
|
strbuf_addf(&buf, "\n%c ", comment_line_char);
|
||||||
strbuf_addf(&buf, _("This is the commit message #%d:"),
|
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, "\n\n");
|
||||||
strbuf_addstr(&buf, body);
|
strbuf_addstr(&buf, body);
|
||||||
} else if (command == TODO_FIXUP) {
|
} else if (command == TODO_FIXUP) {
|
||||||
strbuf_addf(&buf, "\n%c ", comment_line_char);
|
strbuf_addf(&buf, "\n%c ", comment_line_char);
|
||||||
strbuf_addf(&buf, _("The commit message #%d will be skipped:"),
|
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_addstr(&buf, "\n\n");
|
||||||
strbuf_add_commented_lines(&buf, body, strlen(body));
|
strbuf_add_commented_lines(&buf, body, strlen(body));
|
||||||
} else
|
} else
|
||||||
|
|
|
@ -160,13 +160,15 @@ test_expect_success '--skip after failed fixup cleans commit message' '
|
||||||
: The first squash was skipped, therefore: &&
|
: The first squash was skipped, therefore: &&
|
||||||
git show HEAD >out &&
|
git show HEAD >out &&
|
||||||
test_i18ngrep "# This is a combination of 2 commits" 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) &&
|
(test_set_editor "$PWD/copy-editor.sh" && git rebase --skip) &&
|
||||||
git show HEAD >out &&
|
git show HEAD >out &&
|
||||||
test_i18ngrep ! "# This is a combination" out &&
|
test_i18ngrep ! "# This is a combination" out &&
|
||||||
|
|
||||||
: Final squash failed, but there was still a squash &&
|
: 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' '
|
test_expect_success 'setup rerere database' '
|
||||||
|
|
Loading…
Reference in a new issue