Re: [PATCH 4/4] tests: get rid of $_x05 from the test suite
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Mar 11, 2021, 01:23 UTC
- Message-ID
- <xmqq8s6uh4a2.fsf@gitster.g>
- In-Reply-To
- <20210311001447.28254-5-avarab@gmail.com>
Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:
> Remove the last users of the $_x05 variable from the tests. It turns > out that all of these tests can be rewritten unambiguously to simply > use [0-9a-f]* instead.
I am unsure about the "unambiguously" part, e.g.
> - sed -e "s/ $_x05[0-9a-f]* / X /" <current >check && > + sed -e "s/ [0-9a-f]* / X /" <current >check &&
does't the preimage say "we expect at least 5 hexdigits to be shown here"? The postimage lets even an empty string to pass.
> In the case of the tree matching we're relying on there being a <TAB> > after the SHA (but a space between the modes and type), then in some > of the other tests here that an abbreviated SHA is at the start of the > line, etc.
Sure, but these being tests, I am not sure we should be assuming the correct input to these transformations.
Show 7 quoted lines
> test_expect_success 'ls-tree --abbrev=5' ' > git ls-tree --abbrev=5 $tree >current && > - sed -e "s/ $_x05[0-9a-f]* / X /" <current >check && > + sed -e "s/ [0-9a-f]* / X /" <current >check && > cat >expected <<\EOF && > 100644 blob X 1.txt > 100644 blob X 2.txt
This one is particularly iffy. The --abbrev=5 test is designed to ensure that the resulting abbreviated object names are at least 5 hexdigits long, even when the repository is so small that only 4 hexdigits are sufficient to avoid ambiguity, while allowing the output to be longer than specified 5 (when 5 turns out to be insufficient for disambiguation).
So, I dunno.