Subject: Re: [PATCH v2] ls-tree: fix --long implying -r regression in 9c4d58ff2c3

From: Junio C Hamano <[email-masked]>
Date: Thu, 07 Apr 2022 11:40:33 -0700

Ævar Arnfjörð Bjarmason <[email-masked]> writes:

>>>> Let's not go too cute like this.  This forces the caller to remember
>>>> which among 6, 7, and 8 corresponds to which option.  It is too ugly
>>>> to live.
>>>
>>> I think it's rather elegant actually, but to be fair it would, per:
>>>
>>> 	git grep '<&[1-9]| [1-9]<<-'
>>>
>>> Be the user with the most FD's using this sort of pattern.
>>
>> Please give a clear explanation why "-d" has to be 6, "-r" 7 and
>> "-t" 8, that can be used by developers as a memory aid to help them
>> write new tests using the helper.
>
> It's documented when test-lib.sh does the redirection, since Fabian
> Stelzer's a6714088e0c (test-lib: make BAIL_OUT() work in tests and
> prereq, 2021-12-01).

Sorry, but that is not what I asked.  I know what we use lower file
descriptors for, and I didn't ask why we start from 6 (as opposed to
3).

The updated helper forces our developers to know that the expected
result for "-d" has to go to #6 (not #7 or #8), and "-r" to #7 (not
#6 or #8), etc., in order to write new tests using it, and in order
to spot a mistake while reviewing such new tests.

It is an invitation to unmaintainable mess.  Don't encourage it.