Skip to content

Commit f300f56

Browse files
committed
Merge branch 'js/rebase-i-root-fix'
A regression to "rebase -i --root" introduced during this cycle has been fixed. * js/rebase-i-root-fix: rebase --root: fix amending root commit messages rebase --root: demonstrate a bug while amending root commit messages
2 parents f35f43f + 76fda6e commit f300f56

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

sequencer.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -784,7 +784,7 @@ static int run_git_commit(const char *defmsg, struct replay_opts *opts,
784784
struct child_process cmd = CHILD_PROCESS_INIT;
785785
const char *value;
786786

787-
if (flags & CREATE_ROOT_COMMIT) {
787+
if ((flags & CREATE_ROOT_COMMIT) && !(flags & AMEND_MSG)) {
788788
struct strbuf msg = STRBUF_INIT, script = STRBUF_INIT;
789789
const char *author = is_rebase_i(opts) ?
790790
read_author_ident(&script) : NULL;

t/t3404-rebase-interactive.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -971,6 +971,15 @@ test_expect_success 'rebase -i --root fixup root commit' '
971971
test 0 = $(git cat-file commit HEAD | grep -c ^parent\ )
972972
'
973973

974+
test_expect_success 'rebase -i --root reword root commit' '
975+
test_when_finished "test_might_fail git rebase --abort" &&
976+
git checkout -b reword-root-branch master &&
977+
set_fake_editor &&
978+
FAKE_LINES="reword 1 2" FAKE_COMMIT_MESSAGE="A changed" \
979+
git rebase -i --root &&
980+
git show HEAD^ | grep "A changed"
981+
'
982+
974983
test_expect_success C_LOCALE_OUTPUT 'rebase --edit-todo does not work on non-interactive rebase' '
975984
git reset --hard &&
976985
git checkout conflict-branch &&

0 commit comments

Comments
 (0)