git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH v3 1/3] tests: push: improve cleanup of HEAD tests

From
Felipe Contreras <felipe.contreras@gmail.com>
Date
Nov 25, 2020, 23:34 UTC
Message-ID
<20201125233443.63130-2-felipe.contreras@gmail.com>
In-Reply-To
<20201125233443.63130-1-felipe.contreras@gmail.com>
So that we are not left in an inconsistent state between them.
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 t/t5516-fetch-push.sh | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/t/t5516-fetch-push.sh b/t/t5516-fetch-push.sh
index d11382f769..4077471937 100755
--- a/t/t5516-fetch-push.sh
+++ b/t/t5516-fetch-push.sh
@@ -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 &&
-- 
2.29.2
Previous: Felipe ContrerasNext: Felipe Contreras
Message 2 of 7 in “refspec: make @ a synonym of HEAD”
  1. 0/3 refspec: make @ a synonym of HEADFelipe Contreras, Nov 25, 2020
  2. 1/3 tests: push: improve cleanup of HEAD testsFelipe Contreras, Nov 25, 2020
  3. 2/3 tests: push: trivial cleanupFelipe Contreras, Nov 25, 2020
  4. 3/3 refspec: make @ a synonym of HEADFelipe Contreras, Nov 25, 2020
  5. Junio C HamanoNov 25, 2020
  6. Junio C HamanoNov 25, 2020
  7. Johannes SchindelinNov 27, 2020

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.