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>
This commit is contained in:
Jeff King 2017-06-14 06:58:25 -04:00 committed by Junio C Hamano
parent 532139940c
commit 17f2f88c9c
3 changed files with 15 additions and 9 deletions

View file

@ -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 &&

View file

@ -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 &&

View file

@ -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 &&