t/t7004-tag.sh: use the $( ... ) construct for command substitution
authorElia Pinto <gitter.spiros@gmail.com>
Thu, 7 Jan 2016 13:51:49 +0000 (14:51 +0100)
committerJunio C Hamano <gitster@pobox.com>
Thu, 7 Jan 2016 21:58:57 +0000 (13:58 -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/t7004-tag.sh
index 3dd2f51e49d7e6824382ac415cf64842fa3b757f..2797f225308fa28965bc06017a4c0b772ab97025 100755 (executable)
@@ -23,8 +23,8 @@ test_expect_success 'listing all tags in an empty tree should succeed' '
 '
 
 test_expect_success 'listing all tags in an empty tree should output nothing' '
-       test `git tag -l | wc -l` -eq 0 &&
-       test `git tag | wc -l` -eq 0
+       test $(git tag -l | wc -l) -eq 0 &&
+       test $(git tag | wc -l) -eq 0
 '
 
 test_expect_success 'looking for a tag in an empty tree should fail' \
@@ -72,8 +72,8 @@ test_expect_success 'listing all tags if one exists should succeed' '
 '
 
 test_expect_success 'listing all tags if one exists should output that tag' '
-       test `git tag -l` = mytag &&
-       test `git tag` = mytag
+       test $(git tag -l) = mytag &&
+       test $(git tag) = mytag
 '
 
 # pattern matching:
@@ -83,7 +83,7 @@ test_expect_success 'listing a tag using a matching pattern should succeed' \
 
 test_expect_success \
        'listing a tag using a matching pattern should output that tag' \
-       'test `git tag -l mytag` = mytag'
+       'test $(git tag -l mytag) = mytag'
 
 # todo: git tag -l now returns always zero, when fixed, change this test
 test_expect_success \
@@ -92,7 +92,7 @@ test_expect_success \
 
 test_expect_success \
        'listing tags using a non-matching pattern should output nothing' \
-       'test `git tag -l xxx | wc -l` -eq 0'
+       'test $(git tag -l xxx | wc -l) -eq 0'
 
 # special cases for creating tags:
 
@@ -102,13 +102,13 @@ test_expect_success \
 
 test_expect_success \
        'trying to create a tag with a non-valid name should fail' '
-       test `git tag -l | wc -l` -eq 1 &&
+       test $(git tag -l | wc -l) -eq 1 &&
        test_must_fail git tag "" &&
        test_must_fail git tag .othertag &&
        test_must_fail git tag "other tag" &&
        test_must_fail git tag "othertag^" &&
        test_must_fail git tag "other~tag" &&
-       test `git tag -l | wc -l` -eq 1
+       test $(git tag -l | wc -l) -eq 1
 '
 
 test_expect_success 'creating a tag using HEAD directly should succeed' '