Subject: Re: [PATCH v2 1/2] t0001: avoid pipes with Git on LHS

From: Junio C Hamano <[email-masked]>
Date: Wed, 23 Feb 2022 13:10:57 -0800

Shubham Mishra <[email-masked]> writes:

> Pipes ignore error codes of LHS command and thu`s we should not use
> them with Git in tests. As an alternative, use a 'tmp' file to write
> the Git output so we can test the exit code.

I do not know what thu`s is, but the above describes a sensible
criterion to decide which pipe to touch and which pipe to leave
alone.

> -		find .git/worktrees -print | sort >expected &&
> +		find .git/worktrees -print >tmp &&
> +		sort tmp >expected &&

And this change or ...

>  		git -C ../linked-worktree init &&
>  		test_cmp expected-exclude .git/info/exclude &&
>  		test_cmp expected-config .git/config &&
> -		find .git/worktrees -print | sort >actual &&
> +		find .git/worktrees -print >tmp &&
> +		sort tmp >actual &&

... this change squarely contradict the reasoning written in the
proposed log message.  These pipelines place "find" on the upstream
of their pipe, and "find" is not something we are worried about
introducing new bug into.

>  		test_cmp expected actual
>  	)
>  '