Merge branch 'pw/clean-sequencer-state-upon-final-commit'

"git chery-pick" (and "revert" that shares the same runtime engine)
that deals with multiple commits got confused when the final step
gets stopped with a conflict and the user concluded the sequence
with "git commit".  Attempt to fix it by cleaning up the state
files used by these commands in such a situation.

* pw/clean-sequencer-state-upon-final-commit:
  fix cherry-pick/revert status after commit
  commit/reset: try to clean up sequencer state
This commit is contained in:
Junio C Hamano
2019-05-13 23:50:35 +09:00
7 changed files with 201 additions and 9 deletions

View File

@@ -161,6 +161,25 @@ test_expect_success 'successful commit clears CHERRY_PICK_HEAD' '
test_must_fail git rev-parse --verify CHERRY_PICK_HEAD
'
test_expect_success 'successful final commit clears cherry-pick state' '
pristine_detach initial &&
test_must_fail git cherry-pick base picked-signed &&
echo resolved >foo &&
test_path_is_file .git/sequencer/todo &&
git commit -a &&
test_must_fail test_path_exists .git/sequencer
'
test_expect_success 'reset after final pick clears cherry-pick state' '
pristine_detach initial &&
test_must_fail git cherry-pick base picked-signed &&
echo resolved >foo &&
test_path_is_file .git/sequencer/todo &&
git reset &&
test_must_fail test_path_exists .git/sequencer
'
test_expect_success 'failed cherry-pick produces dirty index' '
pristine_detach initial &&
@@ -361,6 +380,26 @@ test_expect_success 'failed commit does not clear REVERT_HEAD' '
test_cmp_rev picked REVERT_HEAD
'
test_expect_success 'successful final commit clears revert state' '
pristine_detach picked-signed &&
test_must_fail git revert picked-signed base &&
echo resolved >foo &&
test_path_is_file .git/sequencer/todo &&
git commit -a &&
test_must_fail test_path_exists .git/sequencer
'
test_expect_success 'reset after final pick clears revert state' '
pristine_detach picked-signed &&
test_must_fail git revert picked-signed base &&
echo resolved >foo &&
test_path_is_file .git/sequencer/todo &&
git reset &&
test_must_fail test_path_exists .git/sequencer
'
test_expect_success 'revert conflict, diff3 -m style' '
pristine_detach initial &&
git config merge.conflictstyle diff3 &&