t9108-git-svn-glob.sh: use the $( ... ) construct for command substitution
authorElia Pinto <gitter.spiros@gmail.com>
Tue, 12 Jan 2016 10:45:14 +0000 (10:45 +0000)
committerJunio C Hamano <gitster@pobox.com>
Tue, 12 Jan 2016 19:47:28 +0000 (11:47 -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/t9108-git-svn-glob.sh
index d732d3130299e964359784949fc97805a2888e39..a526d603793957f781002c98b2da60e1005bf39f 100755 (executable)
@@ -50,10 +50,10 @@ test_expect_success 'test refspec globbing' '
        git log --pretty=oneline refs/remotes/tags/end | \
            sed -e "s/^.\{41\}//" > output.end &&
        test_cmp expect.end output.end &&
-       test "`git rev-parse refs/remotes/tags/end~1`" = \
-               "`git rev-parse refs/remotes/branches/start`" &&
-       test "`git rev-parse refs/remotes/branches/start~2`" = \
-               "`git rev-parse refs/remotes/trunk`" &&
+       test "$(git rev-parse refs/remotes/tags/end~1)" = \
+               "$(git rev-parse refs/remotes/branches/start)" &&
+       test "$(git rev-parse refs/remotes/branches/start~2)" = \
+               "$(git rev-parse refs/remotes/trunk)" &&
        test_must_fail git rev-parse refs/remotes/tags/end@3
        '
 
@@ -75,12 +75,12 @@ test_expect_success 'test left-hand-side only globbing' '
                svn_cmd commit -m "try to try"
        ) &&
        git svn fetch two &&
-       test `git rev-list refs/remotes/two/tags/end | wc -l` -eq 6 &&
-       test `git rev-list refs/remotes/two/branches/start | wc -l` -eq 3 &&
-       test `git rev-parse refs/remotes/two/branches/start~2` = \
-            `git rev-parse refs/remotes/two/trunk` &&
-       test `git rev-parse refs/remotes/two/tags/end~3` = \
-            `git rev-parse refs/remotes/two/branches/start` &&
+       test $(git rev-list refs/remotes/two/tags/end | wc -l) -eq 6 &&
+       test $(git rev-list refs/remotes/two/branches/start | wc -l) -eq 3 &&
+       test $(git rev-parse refs/remotes/two/branches/start~2) = \
+            $(git rev-parse refs/remotes/two/trunk) &&
+       test $(git rev-parse refs/remotes/two/tags/end~3) = \
+            $(git rev-parse refs/remotes/two/branches/start) &&
        git log --pretty=oneline refs/remotes/two/tags/end | \
            sed -e "s/^.\{41\}//" > output.two &&
        test_cmp expect.two output.two