]> git.ipfire.org Git - thirdparty/git.git/commitdiff
t/t1410-reflog.sh: use the $( ... ) construct for command substitution
authorElia Pinto <gitter.spiros@gmail.com>
Tue, 22 Dec 2015 15:05:48 +0000 (16:05 +0100)
committerJunio C Hamano <gitster@pobox.com>
Sun, 27 Dec 2015 23:44:49 +0000 (15:44 -0800)
The Git CodingGuidelines prefer the $(...) construct for command
substitution instead of using the backquotes `...`.

The backquoted form is the traditional method for command
substitution, and is supported by POSIX.  However, all but the
simplest uses become complicated quickly.  In particular, embedded
command substitutions and/or the use of double quotes require
careful escaping with the backslash character.

The patch was generated by:

for _f in $(find . -name "*.sh")
do
perl -i -pe 'BEGIN{undef $/;} s/`(.+?)`/\$(\1)/smg'  "${_f}"
done

and then carefully proof-read.

Signed-off-by: Elia Pinto <gitter.spiros@gmail.com>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t1410-reflog.sh

index b79049f6f606f106e40dfdc241d7a168b10b88cb..fbed8d7fb75a203383647499f2816ddf16080df3 100755 (executable)
@@ -62,18 +62,18 @@ test_expect_success setup '
        git add . &&
 
        test_tick && git commit -m rabbit &&
-       H=`git rev-parse --verify HEAD` &&
-       A=`git rev-parse --verify HEAD:A` &&
-       B=`git rev-parse --verify HEAD:A/B` &&
-       C=`git rev-parse --verify HEAD:C` &&
-       D=`git rev-parse --verify HEAD:A/D` &&
-       E=`git rev-parse --verify HEAD:A/B/E` &&
+       H=$(git rev-parse --verify HEAD) &&
+       A=$(git rev-parse --verify HEAD:A) &&
+       B=$(git rev-parse --verify HEAD:A/B) &&
+       C=$(git rev-parse --verify HEAD:C) &&
+       D=$(git rev-parse --verify HEAD:A/D) &&
+       E=$(git rev-parse --verify HEAD:A/B/E) &&
        check_fsck &&
 
        test_chmod +x C &&
        git add C &&
        test_tick && git commit -m dragon &&
-       L=`git rev-parse --verify HEAD` &&
+       L=$(git rev-parse --verify HEAD) &&
        check_fsck &&
 
        rm -f C A/B/E &&
@@ -81,15 +81,15 @@ test_expect_success setup '
        echo horse >A/G &&
        git add F A/G &&
        test_tick && git commit -a -m sheep &&
-       F=`git rev-parse --verify HEAD:F` &&
-       G=`git rev-parse --verify HEAD:A/G` &&
-       I=`git rev-parse --verify HEAD:A` &&
-       J=`git rev-parse --verify HEAD` &&
+       F=$(git rev-parse --verify HEAD:F) &&
+       G=$(git rev-parse --verify HEAD:A/G) &&
+       I=$(git rev-parse --verify HEAD:A) &&
+       J=$(git rev-parse --verify HEAD) &&
        check_fsck &&
 
        rm -f A/G &&
        test_tick && git commit -a -m monkey &&
-       K=`git rev-parse --verify HEAD` &&
+       K=$(git rev-parse --verify HEAD) &&
        check_fsck &&
 
        check_have A B C D E F G H I J K L &&