git-commit.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 346b54dbc92bb3c928d326da9d8addf5eb50acce
1 file changed +5 -5
contrib/examples/git-commit.sh
+5 -5
@@ -91,7 +91,7 @@ signoff=
91 force_author=
92 only_include_assumed=
93 untracked_files=
94 -templatefile="`git config commit.template`"
94 +templatefile="$(git config commit.template)"
95 while test $# != 0
96 do
97 case "$1" in
@@ -350,7 +350,7 @@ t,)
350 TMP_INDEX="$GIT_DIR/tmp-index$$"
351 W=
352 test -z "$initial_commit" && W=--with-tree=HEAD
353 - commit_only=`git ls-files --error-unmatch $W -- "$@"` || exit
353 + commit_only=$(git ls-files --error-unmatch $W -- "$@") || exit
354
355 # Build a temporary index and update the real index
356 # the same way.
@@ -475,8 +475,8 @@ then
475 fi
476 if test '' != "$force_author"
477 then
478 - GIT_AUTHOR_NAME=`expr "z$force_author" : 'z\(.*[^ ]\) *<.*'` &&
479 - GIT_AUTHOR_EMAIL=`expr "z$force_author" : '.*\(<.*\)'` &&
478 + GIT_AUTHOR_NAME=$(expr "z$force_author" : 'z\(.*[^ ]\) *<.*') &&
479 + GIT_AUTHOR_EMAIL=$(expr "z$force_author" : '.*\(<.*\)') &&
480 test '' != "$GIT_AUTHOR_NAME" &&
481 test '' != "$GIT_AUTHOR_EMAIL" ||
482 die "malformed --author parameter"
@@ -489,7 +489,7 @@ then
489 rloga='commit'
490 if [ -f "$GIT_DIR/MERGE_HEAD" ]; then
491 rloga='commit (merge)'
492 - PARENTS="-p HEAD "`sed -e 's/^/-p /' "$GIT_DIR/MERGE_HEAD"`
492 + PARENTS="-p HEAD "$(sed -e 's/^/-p /' "$GIT_DIR/MERGE_HEAD")
493 elif test -n "$amend"; then
494 rloga='commit (amend)'
495 PARENTS=$(git cat-file commit HEAD |