Re: [PATCH v3 4/9] t3701: don't hard code sha1 hash values
- From
- Phillip Wood <phillip.wood@talktalk.net>
- Date
- Feb 28, 2018, 11:10 UTC
- Message-ID
- <a44c4432-ea10-bf0b-7014-bebee13eef3c@talktalk.net>
- In-Reply-To
- <454d7edf-6331-2ca9-8113-de383aa5df4a@talktalk.net>
On 28/02/18 11:03, Phillip Wood wrote:
Show 43 quoted lines
> On 27/02/18 22:42, Junio C Hamano wrote:
>> Phillip Wood <phillip.wood@talktalk.net> writes:
>>
>>> 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
>
> Ah, good point
>
>> /^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 similarThinking about it some more, just using your last three patterns should do the job. - I'll test and reroll.
> Thanks > > Phillip >