Subject: Re: [PATCH 1/4] test: modernize style of t4006

From: Zbigniew Jędrzejewski-Szmek <[email-masked]>
Date: Tue, 01 May 2012 21:55:07 +0200

On 05/01/2012 08:00 PM, Junio C Hamano wrote:
> Zbigniew Jędrzejewski-Szmek <[email-masked]> writes:
> 
>> Signed-off-by: Zbigniew Jędrzejewski-Szmek <[email-masked]>
>> ---
>>  t/t4006-diff-mode.sh |   32 +++++++++++++++-----------------
>>  1 file changed, 15 insertions(+), 17 deletions(-)
> 
> Style update is welcome, but shouldn't the assignment to sed_script
> be done in the second test if it is the only user?  If you are going to
> add more tests at the end, then it should be away from the second test to
> make it clear that it is not part of it.

Hi,
$sed_script is indeed only used in that one test. But moving the
assignment inside would complicate the quoting rules (the script is now
quoted with ', but this would have to change inside the test case which
is quoted with ' too). I actually think it's simpler this way.

Thanks,
Zbyszek

>> -sed -e 's/\(:100644 100755\) \('"$_x40"'\) \2 /\1 X X /' <current >check
>> -echo ":100644 100755 X X M	rezrov" >expected
>> +# $_x40 is defined in test-lib.sh
>> +sed_script='s/\(:100644 100755\) \('"$_x40"'\) \2 /\1 X X /'