Re: [PATCH v3 02/10] t: silence output from `test_create_repo()`
- From
Eric Sunshine <sunshine@sunshineco.com>
- Date
- May 30, 2025, 21:16 UTC
- Message-ID
- <CAPig+cT+pX2RF0+0E2FvA1TUjh_R8p==8ePFqg=zP+YxWPsCHQ@mail.gmail.com>
- In-Reply-To
- <20250530-pks-meson-tap-v3-2-676f5e41f2e4@pks.im>
On Fri, May 30, 2025 at 9:31 AM Patrick Steinhardt <ps@pks.im> wrote:
Show 33 quoted lines
> 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>
> ---
> diff --git a/t/t4041-diff-submodule-option.sh b/t/t4041-diff-submodule-option.sh
> @@ -48,11 +48,12 @@ commit_file () {
> +test_expect_success 'setup submodule' '
> + git init sm1 &&
> + add_file . foo &&
> + head1=$(add_file sm1 foo1 foo2) &&
> + fullhead1=$(cd sm1 && git rev-parse --verify HEAD)
> +'
> @@ -235,10 +236,13 @@ test_expect_success 'typechanged submodule(submodule->blob)' '
> +test_expect_success 'setup submodule' '
> + rm -f sm1 &&
> + git init sm1 &&
> + head6=$(add_file sm1 foo6 foo7) &&
> + fullhead6=$(cd sm1 && git rev-parse --verify HEAD)
> +'Nit: We now have two tests with identical titles ("setup submodule")
in this script. [1] and [2] suggested using distinct titles. Don't
know if this is worth a reroll, though.[1]: https://lore.kernel.org/git/CAPig+cSYhY+LQ5pD+a1O16Rxwo_js45WqfcW8wtC2daYmNyMCQ@mail.gmail.com/ [2]: https://lore.kernel.org/git/CAPig+cR+eham=uSamUFmTuWDhZ6_r3dnMm1z+X25aw2K6maN7w@mail.gmail.com/