From: Zbigniew Jędrzejewski-Szmek Date: Tue, 01 May 2012 19:55:07 GMT Subject: Re: [PATCH 1/4] test: modernize style of t4006 Message-ID: <4FA03F9B.1020402@in.waw.pl> In-Reply-To: <7vzk9r93ym.fsf@alter.siamese.dyndns.org> On 05/01/2012 08:00 PM, Junio C Hamano wrote: > Zbigniew Jędrzejewski-Szmek writes: > >> Signed-off-by: Zbigniew Jędrzejewski-Szmek >> --- >> 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 /' 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 /'