Skip to content

Commit 76fda6e

Browse files
dschogitster
authored andcommitted
rebase --root: fix amending root commit messages
The code path that triggered that "BUG" really does not want to run without an explicit commit message. In the case where we want to amend a commit message, we have an *implicit* commit message, though: the one of the commit to amend. Therefore, this code path should not even be entered. Signed-off-by: Johannes Schindelin <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 3a36ca0 commit 76fda6e

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
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: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -971,7 +971,7 @@ 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_failure 'rebase -i --root reword root commit' '
974+
test_expect_success 'rebase -i --root reword root commit' '
975975
test_when_finished "test_might_fail git rebase --abort" &&
976976
git checkout -b reword-root-branch master &&
977977
set_fake_editor &&

0 commit comments

Comments
 (0)