Skip to content

Commit 17f2f88

Browse files
peffgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 5321399 commit 17f2f88

File tree

3 files changed

+15
-9
lines changed

3 files changed

+15
-9
lines changed

t/t4041-diff-submodule-option.sh

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -430,9 +430,11 @@ test_expect_success 'deleted submodule' '
430430
test_cmp expected actual
431431
'
432432

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+
'
436438

437439
test_expect_success 'multiple submodules' '
438440
git diff-index -p --submodule=log HEAD >actual &&

t/t4060-diff-submodule-option-diff-format.sh

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -643,9 +643,11 @@ test_expect_success 'deleted submodule' '
643643
test_cmp expected actual
644644
'
645645

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+
'
649651

650652
test_expect_success 'multiple submodules' '
651653
git diff-index -p --submodule=diff HEAD >actual &&

t/t7401-submodule-summary.sh

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -241,9 +241,11 @@ EOF
241241
test_cmp expected actual
242242
"
243243

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+
'
247249

248250
test_expect_success 'multiple submodules' "
249251
git submodule summary >actual &&

0 commit comments

Comments
 (0)