t1020-subdirectory.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
c9e454ccef2f572ce532e29b9d1317c02764545e
1 file changed
+11
-11
t/t1020-subdirectory.sh
+11
-11
@@ -20,27 +20,27 @@ test_expect_success setup '
20
21
test_expect_success 'update-index and ls-files' '
22
git update-index --add one &&
23
- case "`git ls-files`" in
23
+ case "$(git ls-files)" in
24
one) echo pass one ;;
25
*) echo bad one; exit 1 ;;
26
esac &&
27
(
28
cd dir &&
29
git update-index --add two &&
30
- case "`git ls-files`" in
30
+ case "$(git ls-files)" in
31
two) echo pass two ;;
32
*) echo bad two; exit 1 ;;
33
esac
34
) &&
35
- case "`git ls-files`" in
35
+ case "$(git ls-files)" in
36
dir/two"$LF"one) echo pass both ;;
37
*) echo bad; exit 1 ;;
38
esac
39
'
40
41
test_expect_success 'cat-file' '
42
- two=`git ls-files -s dir/two` &&
43
- two=`expr "$two" : "[0-7]* \\([0-9a-f]*\\)"` &&
42
+ two=$(git ls-files -s dir/two) &&
43
+ two=$(expr "$two" : "[0-7]* \\([0-9a-f]*\\)") &&
44
echo "$two" &&
45
git cat-file -p "$two" >actual &&
46
cmp dir/two actual &&
@@ -55,18 +55,18 @@ rm -f actual dir/actual
55
test_expect_success 'diff-files' '
56
echo a >>one &&
57
echo d >>dir/two &&
58
- case "`git diff-files --name-only`" in
58
+ case "$(git diff-files --name-only)" in
59
dir/two"$LF"one) echo pass top ;;
60
*) echo bad top; exit 1 ;;
61
esac &&
62
# diff should not omit leading paths
63
(
64
cd dir &&
65
- case "`git diff-files --name-only`" in
65
+ case "$(git diff-files --name-only)" in
66
dir/two"$LF"one) echo pass subdir ;;
67
*) echo bad subdir; exit 1 ;;
68
esac &&
69
- case "`git diff-files --name-only .`" in
69
+ case "$(git diff-files --name-only .)" in
70
dir/two) echo pass subdir limited ;;
71
*) echo bad subdir limited; exit 1 ;;
72
esac
@@ -74,11 +74,11 @@ test_expect_success 'diff-files' '
74
'
75
76
test_expect_success 'write-tree' '
77
- top=`git write-tree` &&
77
+ top=$(git write-tree) &&
78
echo $top &&
79
(
80
cd dir &&
81
- sub=`git write-tree` &&
81
+ sub=$(git write-tree) &&
82
echo $sub &&
83
test "z$top" = "z$sub"
84
)
@@ -96,7 +96,7 @@ test_expect_success 'checkout-index' '
96
97
test_expect_success 'read-tree' '
98
rm -f one dir/two &&
99
- tree=`git write-tree` &&
99
+ tree=$(git write-tree) &&
100
read_tree_u_must_succeed --reset -u "$tree" &&
101
cmp one original.one &&
102
cmp dir/two original.two &&