Re: [PATCH] t4069: test diff behavior with i-t-a paths
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Aug 10, 2020, 22:22 UTC
- Message-ID
- <xmqqeeoeb0ow.fsf@gitster.c.googlers.com>
- In-Reply-To
- <CAPig+cSUdRE2=PQhAHXTjJc10meAMSC6FqJ+LEjZYQA4shGURA@mail.gmail.com>
Eric Sunshine <sunshine@sunshineco.com> writes:
Show 25 quoted lines
> On Mon, Aug 10, 2020 at 6:09 PM Junio C Hamano <gitster@pobox.com> wrote:
>> Eric Sunshine <sunshine@sunshineco.com> writes:
>> > This can be improved by taking advantage of the OID_REGEX variable
>> > defined by the test suite for matching an OID. So something like this
>> > would be even better:
>> >
>> > cat >expect <<-\EOF &&
>> > diff --git a/test-file b/test-file
>> > index OID..OID 100644
>> > --- a/test-file
>> > +++ b/test-file
>> > EOF
>> > cat blueprint >test-file &&
>> > git diff --ita-visible-in-index -- test-file >raw &&
>> > sed "s/$OID_REGEX/OID/g" raw >actual &&
>> > test_cmp expect actual
>>
>> OID_REGEX is [0-9a-f]{40} while what is used here is [0-9a-f]{1,}.
>> Unless --full-index is in use, they mean different things, no?
>
> You're right, of course. The regex in the original example I gave was
> too loose, matching even single hex letters in words like "index" and
> "test-file", so I wanted to tighten it up, but I botched it with
> OID_REGEX. Anyhow, I hope my examples convey the general idea (which
> needs a bit of tweaking from what I showed).Yeah, perhaps along the lines of
HEX_RX="_x05*" sed -e "s/index $HEX_RX..$HEX_RX /index OID..OID /"