git-fetch.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 16, 2014 at 10:29 UTC 3e867415170ed73511291fb2dd47bac3c4d51f3a
1 file changed +3 -3
contrib/examples/git-fetch.sh
+3 -3
@@ -67,7 +67,7 @@ do
67 keep='-k -k'
68 ;;
69 --depth=*)
70 - shallow_depth="--depth=`expr "z$1" : 'z-[^=]*=\(.*\)'`"
70 + shallow_depth="--depth=$(expr "z$1" : 'z-[^=]*=\(.*\)')"
71 ;;
72 --depth)
73 shift
@@ -262,12 +262,12 @@ fetch_per_ref () {
262 http://* | https://* | ftp://*)
263 test -n "$shallow_depth" &&
264 die "shallow clone with http not supported"
265 - proto=`expr "$remote" : '\([^:]*\):'`
265 + proto=$(expr "$remote" : '\([^:]*\):')
266 if [ -n "$GIT_SSL_NO_VERIFY" ]; then
267 curl_extra_args="-k"
268 fi
269 if [ -n "$GIT_CURL_FTP_NO_EPSV" -o \
270 - "`git config --bool http.noEPSV`" = true ]; then
270 + "$(git config --bool http.noEPSV)" = true ]; then
271 noepsv_opt="--disable-epsv"
272 fi
273