summaryrefslogtreecommitdiff
path: root/sequencer.c
diff options
context:
space:
mode:
authorLibravatar Phillip Wood <phillip.wood@dunelm.org.uk>2021-08-12 13:42:09 +0000
committerLibravatar Junio C Hamano <gitster@pobox.com>2021-08-13 11:36:22 -0700
commite5ee33e8551fa934862b8cbe50693f4841e7dace (patch)
tree01f7e3e7b443c0605669166c83bc5409855349f8 /sequencer.c
parentrebase --apply: restore some tests (diff)
downloadtgif-e5ee33e8551fa934862b8cbe50693f4841e7dace.tar.xz
rebase --continue: remove .git/MERGE_MSG
If the user skips the final commit by removing all the changes from the index and worktree with 'git restore' (or read-tree) and then runs 'git rebase --continue' .git/MERGE_MSG is left behind. This will seed the commit message the next time the user commits which is not what we want to happen. Reported-by: Victor Gambier <vgambier@excilys.com> Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk> Reviewed-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'sequencer.c')
-rw-r--r--sequencer.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/sequencer.c b/sequencer.c
index 0bec01cf38..cb3c93c272 100644
--- a/sequencer.c
+++ b/sequencer.c
@@ -4717,6 +4717,9 @@ static int commit_staged_changes(struct repository *r,
refs_delete_ref(get_main_ref_store(r), "",
"CHERRY_PICK_HEAD", NULL, 0))
return error(_("could not remove CHERRY_PICK_HEAD"));
+ if (unlink(git_path_merge_msg(r)) && errno != ENOENT)
+ return error_errno(_("could not remove '%s'"),
+ git_path_merge_msg(r));
if (!final_fixup)
return 0;
}