Re: [PATCH v3 4/9] t3701: don't hard code sha1 hash values
From: Junio C Hamano <hidden>
Date: 2018-02-27 22:42:32
Phillip Wood [off-list ref] writes:
quoted hunk
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 like /^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?