Skip to content

Commit 12a30a3

Browse files
felipecgitster
authored andcommitted
tests: push: improve cleanup of HEAD tests
So that we are not left in an inconsistent state between them. Signed-off-by: Felipe Contreras <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent b291b0a commit 12a30a3

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

t/t5516-fetch-push.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -449,6 +449,7 @@ test_expect_success 'push with HEAD nonexisting at remote' '
449449
450450
mk_test testrepo heads/master &&
451451
git checkout -b local master &&
452+
test_when_finished "git checkout master; git branch -D local" &&
452453
git push testrepo HEAD &&
453454
check_push_result testrepo $the_commit heads/local
454455
'
@@ -457,8 +458,8 @@ test_expect_success 'push with +HEAD' '
457458
458459
mk_test testrepo heads/master &&
459460
git checkout master &&
460-
git branch -D local &&
461461
git checkout -b local &&
462+
test_when_finished "git checkout master; git branch -D local" &&
462463
git push testrepo master local &&
463464
check_push_result testrepo $the_commit heads/master &&
464465
check_push_result testrepo $the_commit heads/local &&
@@ -488,6 +489,7 @@ test_expect_success 'push with config remote.*.push = HEAD' '
488489
mk_test testrepo heads/local &&
489490
git checkout master &&
490491
git branch -f local $the_commit &&
492+
test_when_finished "git branch -D local" &&
491493
(
492494
cd testrepo &&
493495
git checkout local &&

0 commit comments

Comments
 (0)