commit/reset: try to clean up sequencer state
When cherry-picking or reverting a sequence of commits and if the final pick/revert has conflicts and the user uses `git commit` to commit the conflict resolution and does not run `git cherry-pick --continue` then the sequencer state is left behind. This can cause problems later. In my case I cherry-picked a sequence of commits the last one of which I committed with `git commit` after resolving some conflicts, then a while later, on a different branch I aborted a revert which rewound my HEAD to the end of the cherry-pick sequence on the previous branch. Avoid this potential problem by removing the sequencer state if we're committing or resetting the final pick in a sequence. Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
aeb582a983
commit
b07d9bfd17
4
branch.c
4
branch.c
@ -5,6 +5,7 @@
|
||||
#include "refs.h"
|
||||
#include "refspec.h"
|
||||
#include "remote.h"
|
||||
#include "sequencer.h"
|
||||
#include "commit.h"
|
||||
#include "worktree.h"
|
||||
|
||||
@ -339,8 +340,7 @@ void create_branch(struct repository *r,
|
||||
|
||||
void remove_branch_state(struct repository *r)
|
||||
{
|
||||
unlink(git_path_cherry_pick_head(r));
|
||||
unlink(git_path_revert_head(r));
|
||||
sequencer_post_commit_cleanup(r);
|
||||
unlink(git_path_merge_head(r));
|
||||
unlink(git_path_merge_rr(r));
|
||||
unlink(git_path_merge_msg(r));
|
||||
|
Reference in New Issue
Block a user