t: move "git add submodule" into test blocks
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>
Jeff King committed
Jun 14, 2017 at 06:58 UTC
17f2f88c9c9e0015cba6d962dc6d9e2329ddf713
3 files changed
+15
-9
t/t4041-diff-submodule-option.sh
+5
-3
@@ -430,9 +430,11 @@ test_expect_success 'deleted submodule' '
430
test_cmp expected actual
431
'
432
433
-test_create_repo sm2 &&
434
-head7=$(add_file sm2 foo8 foo9) &&
435
-git add sm2
433
+test_expect_success 'create second submodule' '
434
+ test_create_repo sm2 &&
435
+ head7=$(add_file sm2 foo8 foo9) &&
436
+ git add sm2
437
+'
438
439
test_expect_success 'multiple submodules' '
440
git diff-index -p --submodule=log HEAD >actual &&
t/t4060-diff-submodule-option-diff-format.sh
+5
-3
@@ -643,9 +643,11 @@ test_expect_success 'deleted submodule' '
643
test_cmp expected actual
644
'
645
646
-test_create_repo sm2 &&
647
-head7=$(add_file sm2 foo8 foo9) &&
648
-git add sm2
646
+test_expect_success 'create second submodule' '
647
+ test_create_repo sm2 &&
648
+ head7=$(add_file sm2 foo8 foo9) &&
649
+ git add sm2
650
+'
651
652
test_expect_success 'multiple submodules' '
653
git diff-index -p --submodule=diff HEAD >actual &&
t/t7401-submodule-summary.sh
+5
-3
@@ -241,9 +241,11 @@ EOF
241
test_cmp expected actual
242
"
243
244
-test_create_repo sm2 &&
245
-head7=$(add_file sm2 foo8 foo9) &&
246
-git add sm2
244
+test_expect_success 'create second submodule' '
245
+ test_create_repo sm2 &&
246
+ head7=$(add_file sm2 foo8 foo9) &&
247
+ git add sm2
248
+'
249
250
test_expect_success 'multiple submodules' "
251
git submodule summary >actual &&