From: Eric Sunshine Date: Mon, 10 Aug 2020 21:47:46 GMT Subject: Re: [PATCH] t4069: test diff behavior with i-t-a paths Message-ID: In-Reply-To: On Mon, Aug 10, 2020 at 12:23 PM Eric Sunshine wrote: > To tighten this test, perhaps it makes sense to take a different > approach and check the exact output rather than merely grepping for a > particular string. In other words, something like this might be better > (typed in email, so untested): > > cat >expect <<-\EOF && > diff --git a/test-file b/test-file > index HEX..HEX HEX > --- a/test-file > +++ b/test-file > EOF > cat blueprint >test-file && > git diff --ita-visible-in-index -- test-file >raw && > sed "s/[0-9a-f][0-9a-f]*/HEX/g' raw >actual && > test_cmp expect actual 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