t: move "git add submodule" into test blocks
authorJeff King <peff@peff.net>
Wed, 14 Jun 2017 10:58:25 +0000 (06:58 -0400)
committerJunio C Hamano <gitster@pobox.com>
Thu, 15 Jun 2017 16:10:47 +0000 (09:10 -0700)
Some submodule tests do some setup outside of a test_expect
block. This is bad because we won't actually check the
outcome of those commands. But it's doubly so because "git
add submodule" now produces a warning to stderr, which is
not suppressed by the test scripts in non-verbose mode.

This patch does the minimal to fix the annoying warnings.
All three of these scripts could use more cleanup of related
setup.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t4041-diff-submodule-option.sh
t/t4060-diff-submodule-option-diff-format.sh
t/t7401-submodule-summary.sh
index 2d9731b52d6b880d742e4722ddcc404c59e5f1bd..058ee0829ded8163f99325494f326ef6609fee06 100755 (executable)
@@ -430,9 +430,11 @@ test_expect_success 'deleted submodule' '
        test_cmp expected actual
 '
 
-test_create_repo sm2 &&
-head7=$(add_file sm2 foo8 foo9) &&
-git add sm2
+test_expect_success 'create second submodule' '
+       test_create_repo sm2 &&
+       head7=$(add_file sm2 foo8 foo9) &&
+       git add sm2
+'
 
 test_expect_success 'multiple submodules' '
        git diff-index -p --submodule=log HEAD >actual &&
index 33ec26d7557ab49888584396c14a1b58564c2dcd..4b168d0ed7ff2bbb1d93895de7fdf3f14bfe334e 100755 (executable)
@@ -643,9 +643,11 @@ test_expect_success 'deleted submodule' '
        test_cmp expected actual
 '
 
-test_create_repo sm2 &&
-head7=$(add_file sm2 foo8 foo9) &&
-git add sm2
+test_expect_success 'create second submodule' '
+       test_create_repo sm2 &&
+       head7=$(add_file sm2 foo8 foo9) &&
+       git add sm2
+'
 
 test_expect_success 'multiple submodules' '
        git diff-index -p --submodule=diff HEAD >actual &&
index 366746f0d41342b38126eccc0f58c4ece64cb210..4e4c45550262ca75b36d15e80aa1f4bffc45465f 100755 (executable)
@@ -241,9 +241,11 @@ EOF
        test_cmp expected actual
 "
 
-test_create_repo sm2 &&
-head7=$(add_file sm2 foo8 foo9) &&
-git add sm2
+test_expect_success 'create second submodule' '
+       test_create_repo sm2 &&
+       head7=$(add_file sm2 foo8 foo9) &&
+       git add sm2
+'
 
 test_expect_success 'multiple submodules' "
        git submodule summary >actual &&