t7411: be nicer to future tests and really clean things up
authorAntonio Ospite <ao2@ao2.it>
Fri, 5 Oct 2018 13:05:55 +0000 (15:05 +0200)
committerJunio C Hamano <gitster@pobox.com>
Tue, 9 Oct 2018 03:40:21 +0000 (12:40 +0900)
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>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t7411-submodule-config.sh
index f2cd1f4a2c540beb8c71e79641ac7a7fd2de7f14..b1f3c6489b5946676a00043495e36097e4a56e34 100755 (executable)
@@ -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
        )
 '