Re: [PATCH v3 4/9] t3701: don't hard code sha1 hash values
From: Phillip Wood <hidden>
Date: 2018-02-28 11:10:34
On 28/02/18 11:03, Phillip Wood wrote:
On 27/02/18 22:42, Junio C Hamano wrote:quoted
Phillip Wood [off-list ref] writes:quoted
t/t3701-add-interactive.sh | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-)diff --git a/t/t3701-add-interactive.sh b/t/t3701-add-interactive.sh index bdd1f292a9..46d655038f 100755 --- a/t/t3701-add-interactive.sh +++ b/t/t3701-add-interactive.sh@@ -10,6 +10,16 @@ then test_done fi +diff_cmp () { + for x + do + sed -e '/^index/s/[0-9a-f]*[1-9a-f][0-9a-f]*\.\./1234567../' \ + -e '/^index/s/\.\.[0-9a-f]*[1-9a-f][0-9a-f]*/..9abcdef/' \ + "$x" >"$x.filtered"Interesting ;-) You require .. and on the left hand side you want to see a run of hexdec with at least one non-zero hexdigit, which is filtered to fixed-length 1234567; right hand side is the same deal. Which sounds like a reasonable way to future-proof the comparison. If 7 zeros are expected in the result, and the actual output had 8 zeros, the filter does not touch either so they compare differently, which is somewhat unfortunate. Perhaps something likeAh, good pointquoted
/^index/s/^00*\.\./0000000../ /^index/s/\([^0-9a-f]\)00*\.\./\10000000../ /^index/s/\.\.00*$/..0000000/ /^index/s/\.\.00*\([^0-9a-f]\)/..0000000\1/ after the above two patterns help?Yeah, something like that though matching the beginning and end of the line for the beginning and end of the hashes wont work. I'll reroll with something similar
Thinking about it some more, just using your last three patterns should do the job. - I'll test and reroll.
Thanks Phillip