]> git.ipfire.org Git - thirdparty/git.git/commitdiff
t3407: rework rebase --quit tests
authorPhillip Wood <phillip.wood@dunelm.org.uk>
Mon, 13 Sep 2021 15:19:18 +0000 (15:19 +0000)
committerJunio C Hamano <gitster@pobox.com>
Mon, 13 Sep 2021 19:47:07 +0000 (12:47 -0700)
9512177b68 ("rebase: add --quit to cleanup rebase, leave everything
else untouched", 2016-11-12) seems to have copied the --abort tests
but added two separate tests for the two rebase backends rather than
adding a single test into the existing testrebase() function.

Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t3407-rebase-abort.sh

index f8264449b6c32b73e0f3680ef3aa18fa4f1cd499..162112ba5ea3ac0a401597f6bc102be0d542f2c0 100755 (executable)
@@ -86,31 +86,21 @@ testrebase() {
                test_must_fail git rebase --abort -v &&
                git rebase --abort
        '
+
+       test_expect_success "rebase$type --quit" '
+               test_when_finished "git symbolic-ref HEAD refs/heads/to-rebase" &&
+               # Clean up the state from the previous one
+               git reset --hard pre-rebase &&
+               test_must_fail git rebase$type main &&
+               test_path_is_dir $state_dir &&
+               head_before=$(git rev-parse HEAD) &&
+               git rebase --quit &&
+               test_cmp_rev HEAD $head_before &&
+               test_path_is_missing .git/rebase-apply
+       '
 }
 
 testrebase " --apply" .git/rebase-apply
 testrebase " --merge" .git/rebase-merge
 
-test_expect_success 'rebase --apply --quit' '
-       # Clean up the state from the previous one
-       git reset --hard pre-rebase &&
-       test_must_fail git rebase --apply main &&
-       test_path_is_dir .git/rebase-apply &&
-       head_before=$(git rev-parse HEAD) &&
-       git rebase --quit &&
-       test_cmp_rev HEAD $head_before &&
-       test_path_is_missing .git/rebase-apply
-'
-
-test_expect_success 'rebase --merge --quit' '
-       # Clean up the state from the previous one
-       git reset --hard pre-rebase &&
-       test_must_fail git rebase --merge main &&
-       test_path_is_dir .git/rebase-merge &&
-       head_before=$(git rev-parse HEAD) &&
-       git rebase --quit &&
-       test_cmp_rev HEAD $head_before &&
-       test_path_is_missing .git/rebase-merge
-'
-
 test_done