diff options
Diffstat (limited to 't/t3510-cherry-pick-sequence.sh')
-rwxr-xr-x | t/t3510-cherry-pick-sequence.sh | 39 |
1 files changed, 36 insertions, 3 deletions
diff --git a/t/t3510-cherry-pick-sequence.sh b/t/t3510-cherry-pick-sequence.sh index 49010aa..7eb52b1 100755 --- a/t/t3510-cherry-pick-sequence.sh +++ b/t/t3510-cherry-pick-sequence.sh @@ -90,6 +90,38 @@ test_expect_success 'cherry-pick persists opts correctly' ' test_cmp expect actual ' +test_expect_success 'cherry-pick persists --empty=stop correctly' ' + pristine_detach yetanotherpick && + # Picking `anotherpick` forces a conflict so that we stop. That + # commit is then skipped, after which we pick `yetanotherpick` + # while already on `yetanotherpick` to cause an empty commit + test_must_fail git cherry-pick --empty=stop anotherpick yetanotherpick && + test_must_fail git cherry-pick --skip 2>msg && + test_grep "The previous cherry-pick is now empty" msg && + rm msg && + git cherry-pick --abort +' + +test_expect_success 'cherry-pick persists --empty=drop correctly' ' + pristine_detach yetanotherpick && + # Picking `anotherpick` forces a conflict so that we stop. That + # commit is then skipped, after which we pick `yetanotherpick` + # while already on `yetanotherpick` to cause an empty commit + test_must_fail git cherry-pick --empty=drop anotherpick yetanotherpick && + git cherry-pick --skip && + test_cmp_rev yetanotherpick HEAD +' + +test_expect_success 'cherry-pick persists --empty=keep correctly' ' + pristine_detach yetanotherpick && + # Picking `anotherpick` forces a conflict so that we stop. That + # commit is then skipped, after which we pick `yetanotherpick` + # while already on `yetanotherpick` to cause an empty commit + test_must_fail git cherry-pick --empty=keep anotherpick yetanotherpick && + git cherry-pick --skip && + test_cmp_rev yetanotherpick HEAD^ +' + test_expect_success 'revert persists opts correctly' ' pristine_detach initial && # to make sure that the session to revert a sequence @@ -154,7 +186,7 @@ test_expect_success 'skip "empty" commit' ' pristine_detach picked && test_commit dummy foo d && test_must_fail git cherry-pick anotherpick 2>err && - test_i18ngrep "git cherry-pick --skip" err && + test_grep "git cherry-pick --skip" err && git cherry-pick --skip && test_cmp_rev dummy HEAD ' @@ -238,6 +270,7 @@ test_expect_success 'allow skipping commit but not abort for a new history' ' ' test_expect_success 'allow skipping stopped cherry-pick because of untracked file modifications' ' + test_when_finished "rm unrelated" && pristine_detach initial && git rm --cached unrelated && git commit -m "untrack unrelated" && @@ -313,7 +346,7 @@ test_expect_success '--abort does not unsafely change HEAD' ' git reset --hard base && test_must_fail git cherry-pick picked anotherpick && git cherry-pick --abort 2>actual && - test_i18ngrep "You seem to have moved HEAD" actual && + test_grep "You seem to have moved HEAD" actual && test_cmp_rev base HEAD ' @@ -519,7 +552,7 @@ test_expect_success '--continue asks for help after resolving patch to nil' ' test_cmp_rev unrelatedpick CHERRY_PICK_HEAD && git checkout HEAD -- unrelated && test_must_fail git cherry-pick --continue 2>msg && - test_i18ngrep "The previous cherry-pick is now empty" msg + test_grep "The previous cherry-pick is now empty" msg ' test_expect_success 'follow advice and skip nil patch' ' |