@ -70,18 +78,117 @@ test_expect_success 'cherry-pick cleans up sequencer state upon success' '
@@ -70,18 +78,117 @@ test_expect_success 'cherry-pick cleans up sequencer state upon success' '
test_path_is_missing .git/sequencer
'
test_expect_success '--reset does not complain when no cherry-pick is in progress' '
test_expect_success '--quit does not complain when no cherry-pick is in progress' '
pristine_detach initial &&
git cherry-pick --reset
git cherry-pick --quit
'
test_expect_success '--reset cleans up sequencer state' '
test_expect_success '--abort requires cherry-pick in progress' '
pristine_detach initial &&
test_must_fail git cherry-pick --abort
'
test_expect_success '--quit cleans up sequencer state' '
pristine_detach initial &&
test_must_fail git cherry-pick base..picked &&
git cherry-pick --reset &&
git cherry-pick --quit &&
test_path_is_missing .git/sequencer
'
test_expect_success '--quit keeps HEAD and conflicted index intact' '
pristine_detach initial &&
cat >expect <<-\EOF &&
OBJID
:100644 100644 OBJID OBJID M unrelated
OBJID
:000000 100644 OBJID OBJID A foo
:000000 100644 OBJID OBJID A unrelated
EOF
test_must_fail git cherry-pick base..picked &&
git cherry-pick --quit &&
test_path_is_missing .git/sequencer &&
test_must_fail git update-index --refresh &&
{
git rev-list HEAD |
git diff-tree --root --stdin |
sed "s/$_x40/OBJID/g"
} >actual &&
test_cmp expect actual
'
test_expect_success '--abort to cancel multiple cherry-pick' '
test_expect_success 'cherry-pick cleans up sequencer state when one commit is left' '
pristine_detach initial &&
test_must_fail git cherry-pick base..picked &&
@ -106,6 +213,16 @@ test_expect_success 'cherry-pick cleans up sequencer state when one commit is le
@@ -106,6 +213,16 @@ test_expect_success 'cherry-pick cleans up sequencer state when one commit is le
test_cmp expect actual
'
test_expect_failure '--abort after last commit in sequence' '
pristine_detach initial &&
test_must_fail git cherry-pick base..picked &&
git cherry-pick --abort &&
test_path_is_missing .git/sequencer &&
test_cmp_rev initial HEAD &&
git update-index --refresh &&
git diff-index --exit-code HEAD
'
test_expect_success 'cherry-pick does not implicitly stomp an existing operation' '