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

[PATCH v7 04/10] t7411: be nicer to future tests and really clean things up

From
Antonio Ospite <ao2@ao2.it>
Date
Oct 25, 2018, 16:18 UTC
Message-ID
<20181025161813.17252-5-ao2@ao2.it>
In-Reply-To
<20181025161813.17252-1-ao2@ao2.it>

Tests 5 and 7 in t/t7411-submodule-config.sh add two commits with invalid lines in .gitmodules but then only the second commit is removed.

This may affect future subsequent tests if they assume that the .gitmodules file has no errors.

Remove both the commits as soon as they are not needed anymore.
Signed-off-by: Antonio Ospite <ao2@ao2.it>
---
 t/t7411-submodule-config.sh | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/t/t7411-submodule-config.sh b/t/t7411-submodule-config.sh
index f2cd1f4a2c..b1f3c6489b 100755
--- a/t/t7411-submodule-config.sh
+++ b/t/t7411-submodule-config.sh
@@ -83,6 +83,8 @@ Submodule name: 'submodule' for path 'submodule'
 EOF
 
 test_expect_success 'error in history of one submodule config lets continue, stderr message contains blob ref' '
+	ORIG=$(git -C super rev-parse HEAD) &&
+	test_when_finished "git -C super reset --hard $ORIG" &&
 	(cd super &&
 		cp .gitmodules .gitmodules.bak &&
 		echo "	value = \"" >>.gitmodules &&
@@ -115,6 +117,8 @@ test_expect_success 'using different treeishs works' '
 '
 
 test_expect_success 'error in history in fetchrecursesubmodule lets continue' '
+	ORIG=$(git -C super rev-parse HEAD) &&
+	test_when_finished "git -C super reset --hard $ORIG" &&
 	(cd super &&
 		git config -f .gitmodules \
 			submodule.submodule.fetchrecursesubmodules blabla &&
@@ -126,8 +130,7 @@ test_expect_success 'error in history in fetchrecursesubmodule lets continue' '
 			HEAD b \
 			HEAD submodule \
 				>actual &&
-		test_cmp expect_error actual  &&
-		git reset --hard HEAD^
+		test_cmp expect_error actual
 	)
 '
 
-- 
2.19.1
Previous: Antonio OspiteNext: Antonio Ospite
Message 4 of 17 in “Make submodules work if .gitmodules is not checked out”
  1. 00/10 Make submodules work if .gitmodules is not checked outAntonio Ospite, Oct 25, 2018
  2. 01/10 submodule: add a print_config_from_gitmodules() helperAntonio Ospite, Oct 25, 2018
  3. 05/10 submodule--helper: add a new 'config' subcommandAntonio Ospite, Oct 25, 2018
  4. 04/10 t7411: be nicer to future tests and really clean things upAntonio Ospite, Oct 25, 2018
  5. 09/10 submodule: support reading .gitmodules when it's not in the working treeAntonio Ospite, Oct 25, 2018
  6. Johannes SchindelinOct 30, 2018
  7. Antonio OspiteOct 30, 2018
  8. Junio C HamanoOct 31, 2018
  9. 07/10 t7506: clean up .gitmodules properly before setting up new scenarioAntonio Ospite, Oct 25, 2018
  10. 06/10 submodule: use the 'submodule--helper config' commandAntonio Ospite, Oct 25, 2018
  11. 08/10 submodule: add a helper to check if it is safe to write to .gitmodulesAntonio Ospite, Oct 25, 2018
  12. 10/10 t/helper: add test-submodule-nested-repo-configAntonio Ospite, Oct 25, 2018
  13. 02/10 submodule: factor out a config_set_in_gitmodules_file_gently functionAntonio Ospite, Oct 25, 2018
  14. 03/10 t7411: merge tests 5 and 6Antonio Ospite, Oct 25, 2018
  15. Stefan BellerOct 25, 2018
  16. Junio C HamanoOct 26, 2018
  17. Stefan BellerOct 26, 2018

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.