t/t7505-prepare-commit-msg-hook.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 8, 2016 at 12:06 UTC 0c923256a0116c2729a78dc01dfe223a67d7a95b
1 file changed +16 -16
t/t7505-prepare-commit-msg-hook.sh
+16 -16
@@ -53,7 +53,7 @@ test_expect_success 'with hook (-m)' '
53 echo "more" >> file &&
54 git add file &&
55 git commit -m "more" &&
56 - test "`git log -1 --pretty=format:%s`" = "message (no editor)"
56 + test "$(git log -1 --pretty=format:%s)" = "message (no editor)"
57
58 '
59
@@ -62,7 +62,7 @@ test_expect_success 'with hook (-m editor)' '
62 echo "more" >> file &&
63 git add file &&
64 GIT_EDITOR="\"\$FAKE_EDITOR\"" git commit -e -m "more more" &&
65 - test "`git log -1 --pretty=format:%s`" = message
65 + test "$(git log -1 --pretty=format:%s)" = message
66
67 '
68
@@ -71,7 +71,7 @@ test_expect_success 'with hook (-t)' '
71 echo "more" >> file &&
72 git add file &&
73 git commit -t "$(git rev-parse --git-dir)/template" &&
74 - test "`git log -1 --pretty=format:%s`" = template
74 + test "$(git log -1 --pretty=format:%s)" = template
75
76 '
77
@@ -80,7 +80,7 @@ test_expect_success 'with hook (-F)' '
80 echo "more" >> file &&
81 git add file &&
82 (echo more | git commit -F -) &&
83 - test "`git log -1 --pretty=format:%s`" = "message (no editor)"
83 + test "$(git log -1 --pretty=format:%s)" = "message (no editor)"
84
85 '
86
@@ -89,17 +89,17 @@ test_expect_success 'with hook (-F editor)' '
89 echo "more" >> file &&
90 git add file &&
91 (echo more more | GIT_EDITOR="\"\$FAKE_EDITOR\"" git commit -e -F -) &&
92 - test "`git log -1 --pretty=format:%s`" = message
92 + test "$(git log -1 --pretty=format:%s)" = message
93
94 '
95
96 test_expect_success 'with hook (-C)' '
97
98 - head=`git rev-parse HEAD` &&
98 + head=$(git rev-parse HEAD) &&
99 echo "more" >> file &&
100 git add file &&
101 git commit -C $head &&
102 - test "`git log -1 --pretty=format:%s`" = "$head (no editor)"
102 + test "$(git log -1 --pretty=format:%s)" = "$head (no editor)"
103
104 '
105
@@ -108,27 +108,27 @@ test_expect_success 'with hook (editor)' '
108 echo "more more" >> file &&
109 git add file &&
110 GIT_EDITOR="\"\$FAKE_EDITOR\"" git commit &&
111 - test "`git log -1 --pretty=format:%s`" = default
111 + test "$(git log -1 --pretty=format:%s)" = default
112
113 '
114
115 test_expect_success 'with hook (--amend)' '
116
117 - head=`git rev-parse HEAD` &&
117 + head=$(git rev-parse HEAD) &&
118 echo "more" >> file &&
119 git add file &&
120 GIT_EDITOR="\"\$FAKE_EDITOR\"" git commit --amend &&
121 - test "`git log -1 --pretty=format:%s`" = "$head"
121 + test "$(git log -1 --pretty=format:%s)" = "$head"
122
123 '
124
125 test_expect_success 'with hook (-c)' '
126
127 - head=`git rev-parse HEAD` &&
127 + head=$(git rev-parse HEAD) &&
128 echo "more" >> file &&
129 git add file &&
130 GIT_EDITOR="\"\$FAKE_EDITOR\"" git commit -c $head &&
131 - test "`git log -1 --pretty=format:%s`" = "$head"
131 + test "$(git log -1 --pretty=format:%s)" = "$head"
132
133 '
134
@@ -141,7 +141,7 @@ test_expect_success 'with hook (merge)' '
141 git commit -m other &&
142 git checkout - &&
143 git merge --no-ff other &&
144 - test "`git log -1 --pretty=format:%s`" = "merge (no editor)"
144 + test "$(git log -1 --pretty=format:%s)" = "merge (no editor)"
145 '
146
147 test_expect_success 'with hook and editor (merge)' '
@@ -153,7 +153,7 @@ test_expect_success 'with hook and editor (merge)' '
153 git commit -m other &&
154 git checkout - &&
155 env GIT_EDITOR="\"\$FAKE_EDITOR\"" git merge --no-ff -e other &&
156 - test "`git log -1 --pretty=format:%s`" = "merge"
156 + test "$(git log -1 --pretty=format:%s)" = "merge"
157 '
158
159 cat > "$HOOK" <<'EOF'
@@ -164,7 +164,7 @@ EOF
164 test_expect_success 'with failing hook' '
165
166 test_when_finished "git checkout -f master" &&
167 - head=`git rev-parse HEAD` &&
167 + head=$(git rev-parse HEAD) &&
168 echo "more" >> file &&
169 git add file &&
170 test_must_fail env GIT_EDITOR="\"\$FAKE_EDITOR\"" git commit -c $head
@@ -174,7 +174,7 @@ test_expect_success 'with failing hook' '
174 test_expect_success 'with failing hook (--no-verify)' '
175
176 test_when_finished "git checkout -f master" &&
177 - head=`git rev-parse HEAD` &&
177 + head=$(git rev-parse HEAD) &&
178 echo "more" >> file &&
179 git add file &&
180 test_must_fail env GIT_EDITOR="\"\$FAKE_EDITOR\"" git commit --no-verify -c $head