]> git.ipfire.org Git - thirdparty/git.git/blobdiff - t/t3510-cherry-pick-sequence.sh
The seventh batch
[thirdparty/git.git] / t / t3510-cherry-pick-sequence.sh
index 72020a51c4375fd793af7e0129443cbf8d11d929..7eb52b12edc55702f48812725bfddc282297f9a5 100755 (executable)
@@ -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