t0020-crlf.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 sed -i 's@`\(.*\)`@$(\1)@g' ${_f} done and then carefully proof-read. Signed-off-by: Elia Pinto <gitter.spiros@gmail.com> Reviewed-by: Matthieu Moy <Matthieu.Moy@imag.fr> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Elia Pinto committed Apr 28, 2014 at 05:57 UTC def226bdbb53d32f6c3f6bb66cfe1810089033df
1 file changed +21 -21
t/t0020-crlf.sh
+21 -21
@@ -20,14 +20,14 @@ test_expect_success setup '
20
21 git commit -m initial &&
22
23 - one=`git rev-parse HEAD:one` &&
24 - dir=`git rev-parse HEAD:dir` &&
25 - two=`git rev-parse HEAD:dir/two` &&
26 - three=`git rev-parse HEAD:three` &&
23 + one=$(git rev-parse HEAD:one) &&
24 + dir=$(git rev-parse HEAD:dir) &&
25 + two=$(git rev-parse HEAD:dir/two) &&
26 + three=$(git rev-parse HEAD:three) &&
27
28 for w in Some extra lines here; do echo $w; done >>one &&
29 git diff >patch.file &&
30 - patched=`git hash-object --stdin <one` &&
30 + patched=$(git hash-object --stdin <one) &&
31 git read-tree --reset -u HEAD &&
32
33 echo happy.
@@ -111,7 +111,7 @@ test_expect_success 'update with autocrlf=input' '
111 }
112 done &&
113
114 - differs=`git diff-index --cached HEAD` &&
114 + differs=$(git diff-index --cached HEAD) &&
115 test -z "$differs" || {
116 echo Oops "$differs"
117 false
@@ -135,7 +135,7 @@ test_expect_success 'update with autocrlf=true' '
135 }
136 done &&
137
138 - differs=`git diff-index --cached HEAD` &&
138 + differs=$(git diff-index --cached HEAD) &&
139 test -z "$differs" || {
140 echo Oops "$differs"
141 false
@@ -158,9 +158,9 @@ test_expect_success 'checkout with autocrlf=true' '
158 break
159 }
160 done &&
161 - test "$one" = `git hash-object --stdin <one` &&
162 - test "$two" = `git hash-object --stdin <dir/two` &&
163 - differs=`git diff-index --cached HEAD` &&
161 + test "$one" = $(git hash-object --stdin <one) &&
162 + test "$two" = $(git hash-object --stdin <dir/two) &&
163 + differs=$(git diff-index --cached HEAD) &&
164 test -z "$differs" || {
165 echo Oops "$differs"
166 false
@@ -184,9 +184,9 @@ test_expect_success 'checkout with autocrlf=input' '
184 git update-index -- $f
185 fi
186 done &&
187 - test "$one" = `git hash-object --stdin <one` &&
188 - test "$two" = `git hash-object --stdin <dir/two` &&
189 - differs=`git diff-index --cached HEAD` &&
187 + test "$one" = $(git hash-object --stdin <one) &&
188 + test "$two" = $(git hash-object --stdin <dir/two) &&
189 + differs=$(git diff-index --cached HEAD) &&
190 test -z "$differs" || {
191 echo Oops "$differs"
192 false
@@ -200,7 +200,7 @@ test_expect_success 'apply patch (autocrlf=input)' '
200 git read-tree --reset -u HEAD &&
201
202 git apply patch.file &&
203 - test "$patched" = "`git hash-object --stdin <one`" || {
203 + test "$patched" = "$(git hash-object --stdin <one)" || {
204 echo "Eh? apply without index"
205 false
206 }
@@ -213,7 +213,7 @@ test_expect_success 'apply patch --cached (autocrlf=input)' '
213 git read-tree --reset -u HEAD &&
214
215 git apply --cached patch.file &&
216 - test "$patched" = `git rev-parse :one` || {
216 + test "$patched" = $(git rev-parse :one) || {
217 echo "Eh? apply with --cached"
218 false
219 }
@@ -226,8 +226,8 @@ test_expect_success 'apply patch --index (autocrlf=input)' '
226 git read-tree --reset -u HEAD &&
227
228 git apply --index patch.file &&
229 - test "$patched" = `git rev-parse :one` &&
230 - test "$patched" = `git hash-object --stdin <one` || {
229 + test "$patched" = $(git rev-parse :one) &&
230 + test "$patched" = $(git hash-object --stdin <one) || {
231 echo "Eh? apply with --index"
232 false
233 }
@@ -240,7 +240,7 @@ test_expect_success 'apply patch (autocrlf=true)' '
240 git read-tree --reset -u HEAD &&
241
242 git apply patch.file &&
243 - test "$patched" = "`remove_cr <one | git hash-object --stdin`" || {
243 + test "$patched" = "$(remove_cr <one | git hash-object --stdin)" || {
244 echo "Eh? apply without index"
245 false
246 }
@@ -253,7 +253,7 @@ test_expect_success 'apply patch --cached (autocrlf=true)' '
253 git read-tree --reset -u HEAD &&
254
255 git apply --cached patch.file &&
256 - test "$patched" = `git rev-parse :one` || {
256 + test "$patched" = $(git rev-parse :one) || {
257 echo "Eh? apply without index"
258 false
259 }
@@ -266,8 +266,8 @@ test_expect_success 'apply patch --index (autocrlf=true)' '
266 git read-tree --reset -u HEAD &&
267
268 git apply --index patch.file &&
269 - test "$patched" = `git rev-parse :one` &&
270 - test "$patched" = "`remove_cr <one | git hash-object --stdin`" || {
269 + test "$patched" = $(git rev-parse :one) &&
270 + test "$patched" = "$(remove_cr <one | git hash-object --stdin)" || {
271 echo "Eh? apply with --index"
272 false
273 }