Make remove_sequencer_state() remove '.git/CHERRY_PICK_HEAD' when invoked aggressively, since we want to treat it as part of the sequencer state now. While at it, make some minor improvements to the function. Signed-off-by: Ramkumar Ramachandra <artagnon@xxxxxxxxx> --- sequencer.c | 27 ++++++++++++++++----------- 1 files changed, 16 insertions(+), 11 deletions(-) diff --git a/sequencer.c b/sequencer.c index 87f146b..e566043 100644 --- a/sequencer.c +++ b/sequencer.c @@ -25,17 +25,22 @@ static char *get_encoding(const char *message); void remove_sequencer_state(int aggressive) { - struct strbuf seq_dir = STRBUF_INIT; - struct strbuf seq_old_dir = STRBUF_INIT; - - strbuf_addf(&seq_dir, "%s", git_path(SEQ_DIR)); - strbuf_addf(&seq_old_dir, "%s", git_path(SEQ_OLD_DIR)); - remove_dir_recursively(&seq_old_dir, 0); - rename(git_path(SEQ_DIR), git_path(SEQ_OLD_DIR)); - if (aggressive) - remove_dir_recursively(&seq_old_dir, 0); - strbuf_release(&seq_dir); - strbuf_release(&seq_old_dir); + const char *seq_dir = git_path(SEQ_DIR); + const char *seq_old_dir = git_path(SEQ_OLD_DIR); + const char *cherry_pick_head = git_path("CHERRY_PICK_HEAD"); + struct strbuf seq_dir_buf = STRBUF_INIT; + struct strbuf seq_old_dir_buf = STRBUF_INIT; + + strbuf_addf(&seq_dir_buf, "%s", seq_dir); + strbuf_addf(&seq_old_dir_buf, "%s", seq_old_dir); + remove_dir_recursively(&seq_old_dir_buf, 0); + rename(seq_dir, seq_old_dir); + if (aggressive) { + remove_dir_recursively(&seq_old_dir_buf, 0); + unlink(cherry_pick_head); + } + strbuf_release(&seq_dir_buf); + strbuf_release(&seq_old_dir_buf); } struct commit_message { -- 1.7.6.351.gb35ac.dirty -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html