Subject: Re: [PATCH v2 6/6] t2019: don't create unused files

From: Ævar Arnfjörð Bjarmason <[email-masked]>
Date: Thu, 06 Apr 2023 10:44:06 +0200

On Tue, Apr 04 2023, Andrei Rybak wrote:

> Tests in t2019-checkout-ambiguous-ref.sh redirect two invocations of
> "git checkout" to files "stdout" and "stderr".  Several assertions are
> made using file "stderr".  File "stdout", however, is unused.
>
> Don't redirect standard output of "git checkout" to file "stdout" in
> t2019-checkout-ambiguous-ref.sh to avoid creating unnecessary files.
>
> Signed-off-by: Andrei Rybak <[email-masked]>
> ---
>  t/t2019-checkout-ambiguous-ref.sh | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/t/t2019-checkout-ambiguous-ref.sh b/t/t2019-checkout-ambiguous-ref.sh
> index 2c8c926b4d..9540588664 100755
> --- a/t/t2019-checkout-ambiguous-ref.sh
> +++ b/t/t2019-checkout-ambiguous-ref.sh
> @@ -16,7 +16,7 @@ test_expect_success 'setup ambiguous refs' '
>  '
>  
>  test_expect_success 'checkout ambiguous ref succeeds' '
> -	git checkout ambiguity >stdout 2>stderr
> +	git checkout ambiguity 2>stderr
>  '

Ditto earlier comments that we should just fix this, if I make this
">out" and "test_must_be_empty out" this succeeds, shouldn't we just use
that?

>  test_expect_success 'checkout produces ambiguity warning' '

As an aside, we should really just combine these two tests.

> @@ -37,7 +37,7 @@ test_expect_success 'checkout reports switch to branch' '
>  '
>  
>  test_expect_success 'checkout vague ref succeeds' '
> -	git checkout vagueness >stdout 2>stderr &&
> +	git checkout vagueness 2>stderr &&
>  	test_set_prereq VAGUENESS_SUCCESS
>  '