Git fork

t: silence output from `test_create_repo()`

There are a couple users of `test_create_repo()` that use this function
outside of any test case. This function is nowadays only a thin wrapper
around `git init`, which by default prints a message to stdout that the
repository has been initialized. The resulting output may thus confuse
TAP parsers.

Refactor these users to instead create the repository in a "setup" test
case so that we don't explicitly have to silence them. There's one
exception in t1007: we use `push_repo()` and its `pop_repo()` equivalent
multiple times, so to reduce the noise introduced by this patch we
instead silence this invocation.

While at it, convert callsites to use git-init(1) directly as the
`test_create_repo()` function has been deprecated in f0d4d398e28
(test-lib: split up and deprecate test_create_repo(), 2021-05-10).

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

authored by

Patrick Steinhardt and committed by
Junio C Hamano
ddfcb9d4 faac9d46

+31 -20
+1 -1
t/t1007-hash-object.sh
··· 30 30 31 31 test_repo=test 32 32 push_repo() { 33 - test_create_repo $test_repo 33 + git init --quiet $test_repo 34 34 cd $test_repo 35 35 36 36 setup_repo
+13 -9
t/t4041-diff-submodule-option.sh
··· 48 48 git commit "$@" -m "Commit $*" >/dev/null 49 49 } 50 50 51 - test_create_repo sm1 && 52 - add_file . foo >/dev/null 53 - 54 - head1=$(add_file sm1 foo1 foo2) 55 - fullhead1=$(cd sm1; git rev-parse --verify HEAD) 51 + test_expect_success 'setup submodule' ' 52 + git init sm1 && 53 + add_file . foo && 54 + head1=$(add_file sm1 foo1 foo2) && 55 + fullhead1=$(cd sm1 && git rev-parse --verify HEAD) 56 + ' 56 57 57 58 test_expect_success 'added submodule' ' 58 59 git add sm1 && ··· 235 236 test_cmp expected actual 236 237 ' 237 238 238 - rm -f sm1 && 239 - test_create_repo sm1 && 240 - head6=$(add_file sm1 foo6 foo7) 241 - fullhead6=$(cd sm1; git rev-parse --verify HEAD) 239 + test_expect_success 'setup submodule anew' ' 240 + rm -f sm1 && 241 + git init sm1 && 242 + head6=$(add_file sm1 foo6 foo7) && 243 + fullhead6=$(cd sm1 && git rev-parse --verify HEAD) 244 + ' 245 + 242 246 test_expect_success 'nonexistent commit' ' 243 247 git diff-index -p --submodule=log HEAD >actual && 244 248 cat >expected <<-EOF &&
+6 -3
t/t4060-diff-submodule-option-diff-format.sh
··· 363 363 diff_cmp expected actual 364 364 ' 365 365 366 - rm -f sm1 && 367 - test_create_repo sm1 && 368 - head6=$(add_file sm1 foo6 foo7) 366 + test_expect_success 'setup' ' 367 + rm -f sm1 && 368 + git init sm1 && 369 + head6=$(add_file sm1 foo6 foo7) 370 + ' 371 + 369 372 test_expect_success 'nonexistent commit' ' 370 373 git diff-index -p --submodule=diff HEAD >actual && 371 374 cat >expected <<-EOF &&
+11 -7
t/t7401-submodule-summary.sh
··· 38 38 git commit "$@" -m "Commit $*" >/dev/null 39 39 } 40 40 41 - test_create_repo sm1 && 42 - add_file . foo >/dev/null 43 - 44 - head1=$(add_file sm1 foo1 foo2) 41 + test_expect_success 'setup submodule' ' 42 + git init sm1 && 43 + add_file . foo && 44 + head1=$(add_file sm1 foo1 foo2) 45 + ' 45 46 46 47 test_expect_success 'added submodule' " 47 48 git add sm1 && ··· 214 215 test_cmp expected actual 215 216 " 216 217 217 - rm -f sm1 && 218 - test_create_repo sm1 && 219 - head6=$(add_file sm1 foo6 foo7) 218 + test_expect_success 'setup submodule' ' 219 + rm -f sm1 && 220 + git init sm1 && 221 + head6=$(add_file sm1 foo6 foo7) 222 + ' 223 + 220 224 test_expect_success 'nonexistent commit' " 221 225 git submodule summary >actual && 222 226 cat >expected <<-EOF &&