Skip to content
This repository was archived by the owner on Nov 9, 2017. It is now read-only.

Commit 346b54d

Browse files
devzero2000gitster
authored andcommitted
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 <[email protected]> Reviewed-by: Matthieu Moy <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent add77e8 commit 346b54d

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

contrib/examples/git-commit.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ signoff=
9191
force_author=
9292
only_include_assumed=
9393
untracked_files=
94-
templatefile="`git config commit.template`"
94+
templatefile="$(git config commit.template)"
9595
while test $# != 0
9696
do
9797
case "$1" in
@@ -350,7 +350,7 @@ t,)
350350
TMP_INDEX="$GIT_DIR/tmp-index$$"
351351
W=
352352
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
354354

355355
# Build a temporary index and update the real index
356356
# the same way.
@@ -475,8 +475,8 @@ then
475475
fi
476476
if test '' != "$force_author"
477477
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" : '.*\(<.*\)') &&
480480
test '' != "$GIT_AUTHOR_NAME" &&
481481
test '' != "$GIT_AUTHOR_EMAIL" ||
482482
die "malformed --author parameter"
@@ -489,7 +489,7 @@ then
489489
rloga='commit'
490490
if [ -f "$GIT_DIR/MERGE_HEAD" ]; then
491491
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")
493493
elif test -n "$amend"; then
494494
rloga='commit (amend)'
495495
PARENTS=$(git cat-file commit HEAD |

0 commit comments

Comments
 (0)