tests: push: improve cleanup of HEAD tests

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>

Felipe Contreras committed Nov 25, 2020 at 18:16 UTC 12a30a3ea65f1d27698927c5a871935f6c1223f9
1 file changed +3 -1
t/t5516-fetch-push.sh
+3 -1
@@ -449,6 +449,7 @@ test_expect_success 'push with HEAD nonexisting at remote' '
449
450 mk_test testrepo heads/master &&
451 git checkout -b local master &&
452 + test_when_finished "git checkout master; git branch -D local" &&
453 git push testrepo HEAD &&
454 check_push_result testrepo $the_commit heads/local
455 '
@@ -457,8 +458,8 @@ test_expect_success 'push with +HEAD' '
458
459 mk_test testrepo heads/master &&
460 git checkout master &&
460 - git branch -D local &&
461 git checkout -b local &&
462 + test_when_finished "git checkout master; git branch -D local" &&
463 git push testrepo master local &&
464 check_push_result testrepo $the_commit heads/master &&
465 check_push_result testrepo $the_commit heads/local &&
@@ -488,6 +489,7 @@ test_expect_success 'push with config remote.*.push = HEAD' '
489 mk_test testrepo heads/local &&
490 git checkout master &&
491 git branch -f local $the_commit &&
492 + test_when_finished "git branch -D local" &&
493 (
494 cd testrepo &&
495 git checkout local &&