]> git.ipfire.org Git - thirdparty/git.git/commitdiff
tests: push: improve cleanup of HEAD tests
authorFelipe Contreras <felipe.contreras@gmail.com>
Thu, 26 Nov 2020 00:16:14 +0000 (18:16 -0600)
committerJunio C Hamano <gitster@pobox.com>
Mon, 30 Nov 2020 21:57:54 +0000 (13:57 -0800)
So that we are not left in an inconsistent state between them.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t5516-fetch-push.sh

index d11382f769f6669aa1f95e83a45fd266d4b9e304..4077471937d477079a837f6d5d31ac3f7aa5897a 100755 (executable)
@@ -449,6 +449,7 @@ test_expect_success 'push with HEAD nonexisting at remote' '
 
        mk_test testrepo heads/master &&
        git checkout -b local master &&
+       test_when_finished "git checkout master; git branch -D local" &&
        git push testrepo HEAD &&
        check_push_result testrepo $the_commit heads/local
 '
@@ -457,8 +458,8 @@ test_expect_success 'push with +HEAD' '
 
        mk_test testrepo heads/master &&
        git checkout master &&
-       git branch -D local &&
        git checkout -b local &&
+       test_when_finished "git checkout master; git branch -D local" &&
        git push testrepo master local &&
        check_push_result testrepo $the_commit heads/master &&
        check_push_result testrepo $the_commit heads/local &&
@@ -488,6 +489,7 @@ test_expect_success 'push with config remote.*.push = HEAD' '
        mk_test testrepo heads/local &&
        git checkout master &&
        git branch -f local $the_commit &&
+       test_when_finished "git branch -D local" &&
        (
                cd testrepo &&
                git checkout local &&