t/t7004-tag.sh: use the $( ... ) construct for command substitution

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>

Elia Pinto committed Jan 7, 2016 at 14:51 UTC 63873a0aa7a5ae7bc84342a04849a9a33c7670b4
1 file changed +8 -8
t/t7004-tag.sh
+8 -8
@@ -23,8 +23,8 @@ test_expect_success 'listing all tags in an empty tree should succeed' '
23 '
24
25 test_expect_success 'listing all tags in an empty tree should output nothing' '
26 - test `git tag -l | wc -l` -eq 0 &&
27 - test `git tag | wc -l` -eq 0
26 + test $(git tag -l | wc -l) -eq 0 &&
27 + test $(git tag | wc -l) -eq 0
28 '
29
30 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' '
72 '
73
74 test_expect_success 'listing all tags if one exists should output that tag' '
75 - test `git tag -l` = mytag &&
76 - test `git tag` = mytag
75 + test $(git tag -l) = mytag &&
76 + test $(git tag) = mytag
77 '
78
79 # pattern matching:
@@ -83,7 +83,7 @@ test_expect_success 'listing a tag using a matching pattern should succeed' \
83
84 test_expect_success \
85 'listing a tag using a matching pattern should output that tag' \
86 - 'test `git tag -l mytag` = mytag'
86 + 'test $(git tag -l mytag) = mytag'
87
88 # todo: git tag -l now returns always zero, when fixed, change this test
89 test_expect_success \
@@ -92,7 +92,7 @@ test_expect_success \
92
93 test_expect_success \
94 'listing tags using a non-matching pattern should output nothing' \
95 - 'test `git tag -l xxx | wc -l` -eq 0'
95 + 'test $(git tag -l xxx | wc -l) -eq 0'
96
97 # special cases for creating tags:
98
@@ -102,13 +102,13 @@ test_expect_success \
102
103 test_expect_success \
104 'trying to create a tag with a non-valid name should fail' '
105 - test `git tag -l | wc -l` -eq 1 &&
105 + test $(git tag -l | wc -l) -eq 1 &&
106 test_must_fail git tag "" &&
107 test_must_fail git tag .othertag &&
108 test_must_fail git tag "other tag" &&
109 test_must_fail git tag "othertag^" &&
110 test_must_fail git tag "other~tag" &&
111 - test `git tag -l | wc -l` -eq 1
111 + test $(git tag -l | wc -l) -eq 1
112 '
113
114 test_expect_success 'creating a tag using HEAD directly should succeed' '