t/t6001-rev-list-graft.sh: use the $( ... ) construct for command substitution
authorElia Pinto <gitter.spiros@gmail.com>
Thu, 7 Jan 2016 13:51:42 +0000 (14:51 +0100)
committerJunio C Hamano <gitster@pobox.com>
Thu, 7 Jan 2016 21:56:47 +0000 (13:56 -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>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t6001-rev-list-graft.sh
index 8efcd130795890c36dfe6c5c630d2be44c6e1699..05ddc69cf2ad9470a125fda47fc450401f94902b 100755 (executable)
@@ -10,15 +10,15 @@ test_expect_success setup '
        echo >subdir/fileB fileB &&
        git add fileA subdir/fileB &&
        git commit -a -m "Initial in one history." &&
-       A0=`git rev-parse --verify HEAD` &&
+       A0=$(git rev-parse --verify HEAD) &&
 
        echo >fileA fileA modified &&
        git commit -a -m "Second in one history." &&
-       A1=`git rev-parse --verify HEAD` &&
+       A1=$(git rev-parse --verify HEAD) &&
 
        echo >subdir/fileB fileB modified &&
        git commit -a -m "Third in one history." &&
-       A2=`git rev-parse --verify HEAD` &&
+       A2=$(git rev-parse --verify HEAD) &&
 
        rm -f .git/refs/heads/master .git/index &&
 
@@ -26,15 +26,15 @@ test_expect_success setup '
        echo >subdir/fileB fileB again &&
        git add fileA subdir/fileB &&
        git commit -a -m "Initial in alternate history." &&
-       B0=`git rev-parse --verify HEAD` &&
+       B0=$(git rev-parse --verify HEAD) &&
 
        echo >fileA fileA modified in alternate history &&
        git commit -a -m "Second in alternate history." &&
-       B1=`git rev-parse --verify HEAD` &&
+       B1=$(git rev-parse --verify HEAD) &&
 
        echo >subdir/fileB fileB modified in alternate history &&
        git commit -a -m "Third in alternate history." &&
-       B2=`git rev-parse --verify HEAD` &&
+       B2=$(git rev-parse --verify HEAD) &&
        : done
 '