t4012-diff-binary.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 30, 2014 at 09:22 UTC e6ce6f4c7a8bcb2a77e664d0dfc42ee9c2d164d0
1 file changed +8 -8
t/t4012-diff-binary.sh
+8 -8
@@ -67,18 +67,18 @@ test_expect_success C_LOCALE_OUTPUT 'apply detecting corrupt patch correctly' '
67 git diff >output &&
68 sed -e "s/-CIT/xCIT/" <output >broken &&
69 test_must_fail git apply --stat --summary broken 2>detected &&
70 - detected=`cat detected` &&
71 - detected=`expr "$detected" : "fatal.*at line \\([0-9]*\\)\$"` &&
72 - detected=`sed -ne "${detected}p" broken` &&
70 + detected=$(cat detected) &&
71 + detected=$(expr "$detected" : "fatal.*at line \\([0-9]*\\)\$") &&
72 + detected=$(sed -ne "${detected}p" broken) &&
73 test "$detected" = xCIT
74 '
75
76 test_expect_success C_LOCALE_OUTPUT 'apply detecting corrupt patch correctly' '
77 git diff --binary | sed -e "s/-CIT/xCIT/" >broken &&
78 test_must_fail git apply --stat --summary broken 2>detected &&
79 - detected=`cat detected` &&
80 - detected=`expr "$detected" : "fatal.*at line \\([0-9]*\\)\$"` &&
81 - detected=`sed -ne "${detected}p" broken` &&
79 + detected=$(cat detected) &&
80 + detected=$(expr "$detected" : "fatal.*at line \\([0-9]*\\)\$") &&
81 + detected=$(sed -ne "${detected}p" broken) &&
82 test "$detected" = xCIT
83 '
84
@@ -88,7 +88,7 @@ test_expect_success 'initial commit' 'git commit -a -m initial'
88 test_expect_success 'diff-index with --binary' '
89 echo AIT >a && mv b e && echo CIT >c && cat e >d &&
90 git update-index --add --remove a b c d e &&
91 - tree0=`git write-tree` &&
91 + tree0=$(git write-tree) &&
92 git diff --cached --binary >current &&
93 git apply --stat --summary current
94 '
@@ -96,7 +96,7 @@ test_expect_success 'diff-index with --binary' '
96 test_expect_success 'apply binary patch' '
97 git reset --hard &&
98 git apply --binary --index <current &&
99 - tree1=`git write-tree` &&
99 + tree1=$(git write-tree) &&
100 test "$tree1" = "$tree0"
101 '
102