Re: [PATCH] t4069: test diff behavior with i-t-a paths
- From
Eric Sunshine <sunshine@sunshineco.com>
- Date
- Aug 10, 2020, 22:13 UTC
- Message-ID
- <CAPig+cSUdRE2=PQhAHXTjJc10meAMSC6FqJ+LEjZYQA4shGURA@mail.gmail.com>
- In-Reply-To
- <xmqqk0y6b1b0.fsf@gitster.c.googlers.com>
On Mon, Aug 10, 2020 at 6:09 PM Junio C Hamano <gitster@pobox.com> wrote:
Show 18 quoted lines
> 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).