From 3e7dd9920823fc2a88f8ec5390bd100d707f9129 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nguy=E1=BB=85n=20Th=C3=A1i=20Ng=E1=BB=8Dc=20Duy?= Date: Thu, 16 Aug 2018 18:06:08 +0200 Subject: cherry-pick: fix --quit not deleting CHERRY_PICK_HEAD MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --quit is supposed to be --abort but without restoring HEAD. Leaving CHERRY_PICK_HEAD behind could make other commands mistake that cherry-pick is still ongoing (e.g. "git commit --amend" will refuse to work). Clean it too. For --abort, this job of deleting CHERRY_PICK_HEAD is on "git reset" so we don't need to do anything else. But let's add extra checks in --abort tests to confirm. Signed-off-by: Nguyễn Thái Ngọc Duy Signed-off-by: Junio C Hamano --- builtin/revert.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'builtin') diff --git a/builtin/revert.c b/builtin/revert.c index b9d927eb09..baf1cd70d1 100644 --- a/builtin/revert.c +++ b/builtin/revert.c @@ -7,6 +7,7 @@ #include "rerere.h" #include "dir.h" #include "sequencer.h" +#include "branch.h" /* * This implements the builtins revert and cherry-pick. @@ -191,8 +192,12 @@ static int run_sequencer(int argc, const char **argv, struct replay_opts *opts) opts->gpg_sign = xstrdup_or_null(opts->gpg_sign); opts->strategy = xstrdup_or_null(opts->strategy); - if (cmd == 'q') - return sequencer_remove_state(opts); + if (cmd == 'q') { + int ret = sequencer_remove_state(opts); + if (!ret) + remove_branch_state(); + return ret; + } if (cmd == 'c') return sequencer_continue(opts); if (cmd == 'a') -- cgit v1.2.3