On Mon, Aug 10, 2020 at 6:09 PM Junio C Hamano <gitster@xxxxxxxxx> wrote: > Eric Sunshine <sunshine@xxxxxxxxxxxxxx> 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).