Re: [PATCH] t4069: test diff behavior with i-t-a paths
From: Junio C Hamano <hidden>
Date: 2020-08-10 22:23:05
Eric Sunshine [off-list ref] writes:
On Mon, Aug 10, 2020 at 6:09 PM Junio C Hamano [off-list ref] wrote:quoted
Eric Sunshine [off-list ref] writes:quoted
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 actualOID_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 /"