sequencer (rebase -i): remove CHERRY_PICK_HEAD when no longer needed
authorJohannes Schindelin <johannes.schindelin@gmx.de>
Mon, 2 Jan 2017 15:27:25 +0000 (16:27 +0100)
committerJunio C Hamano <gitster@pobox.com>
Mon, 9 Jan 2017 22:57:29 +0000 (14:57 -0800)
The scripted version of the interactive rebase already does that.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
sequencer.c
index 69301fecc6cf7d9392f5a2d1c1ba31ace9f30a23..52e17c8887ad73a1c94debef8a28ec379691774a 100644 (file)
@@ -1832,8 +1832,13 @@ static int commit_staged_changes(struct replay_opts *opts)
 
        if (has_unstaged_changes(1))
                return error(_("cannot rebase: You have unstaged changes."));
-       if (!has_uncommitted_changes(0))
+       if (!has_uncommitted_changes(0)) {
+               const char *cherry_pick_head = git_path("CHERRY_PICK_HEAD");
+
+               if (file_exists(cherry_pick_head) && unlink(cherry_pick_head))
+                       return error(_("could not remove CHERRY_PICK_HEAD"));
                return 0;
+       }
 
        if (file_exists(rebase_path_amend())) {
                struct strbuf rev = STRBUF_INIT;