From: Elia Pinto <gitter.spiros@gmail.com>
To: git@vger.kernel.org
Cc: Elia Pinto <gitter.spiros@gmail.com>
Subject: [PATCH 005/14] git-commit.sh: use the $( ... ) construct for command substitution
Date: Wed, 16 Apr 2014 10:29:49 -0700 [thread overview]
Message-ID: <1397669398-25410-5-git-send-email-gitter.spiros@gmail.com> (raw)
In-Reply-To: <1397669398-25410-1-git-send-email-gitter.spiros@gmail.com>
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>
---
contrib/examples/git-commit.sh | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/contrib/examples/git-commit.sh b/contrib/examples/git-commit.sh
index 4aab1a6..5cafe2e 100755
--- a/contrib/examples/git-commit.sh
+++ b/contrib/examples/git-commit.sh
@@ -91,7 +91,7 @@ signoff=
force_author=
only_include_assumed=
untracked_files=
-templatefile="`git config commit.template`"
+templatefile="$(git config commit.template)"
while test $# != 0
do
case "$1" in
@@ -350,7 +350,7 @@ t,)
TMP_INDEX="$GIT_DIR/tmp-index$$"
W=
test -z "$initial_commit" && W=--with-tree=HEAD
- commit_only=`git ls-files --error-unmatch $W -- "$@"` || exit
+ commit_only=$(git ls-files --error-unmatch $W -- "$@") || exit
# Build a temporary index and update the real index
# the same way.
@@ -475,8 +475,8 @@ then
fi
if test '' != "$force_author"
then
- GIT_AUTHOR_NAME=`expr "z$force_author" : 'z\(.*[^ ]\) *<.*'` &&
- GIT_AUTHOR_EMAIL=`expr "z$force_author" : '.*\(<.*\)'` &&
+ GIT_AUTHOR_NAME=$(expr "z$force_author" : 'z\(.*[^ ]\) *<.*') &&
+ GIT_AUTHOR_EMAIL=$(expr "z$force_author" : '.*\(<.*\)') &&
test '' != "$GIT_AUTHOR_NAME" &&
test '' != "$GIT_AUTHOR_EMAIL" ||
die "malformed --author parameter"
@@ -489,7 +489,7 @@ then
rloga='commit'
if [ -f "$GIT_DIR/MERGE_HEAD" ]; then
rloga='commit (merge)'
- PARENTS="-p HEAD "`sed -e 's/^/-p /' "$GIT_DIR/MERGE_HEAD"`
+ PARENTS="-p HEAD "$(sed -e 's/^/-p /' "$GIT_DIR/MERGE_HEAD")
elif test -n "$amend"; then
rloga='commit (amend)'
PARENTS=$(git cat-file commit HEAD |
--
1.7.10.4
next prev parent reply other threads:[~2014-04-16 17:32 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-16 17:29 [PATCH 001/14] howto-index.sh: use the $( ... ) construct for command substitution Elia Pinto
2014-04-16 17:29 ` [PATCH 002/14] install-webdoc.sh: " Elia Pinto
2014-04-16 17:29 ` [PATCH 003/14] git-checkout.sh: " Elia Pinto
2014-04-16 17:29 ` [PATCH 004/14] git-clone.sh: " Elia Pinto
2014-04-16 17:29 ` Elia Pinto [this message]
2014-04-16 17:29 ` [PATCH 006/14] git-fetch.sh: " Elia Pinto
2014-04-16 17:29 ` [PATCH 007/14] git-ls-remote.sh: " Elia Pinto
2014-04-16 17:29 ` [PATCH 008/14] git-merge.sh: " Elia Pinto
2014-04-16 17:29 ` [PATCH 009/14] git-repack.sh: " Elia Pinto
2014-04-16 17:29 ` [PATCH 010/14] git-resolve.sh: " Elia Pinto
2014-04-16 17:29 ` [PATCH 011/14] git-revert.sh: " Elia Pinto
2014-04-16 17:29 ` [PATCH 012/14] git-tag.sh: " Elia Pinto
2014-04-16 17:29 ` [PATCH 013/14] t9360-mw-to-git-clone.sh: " Elia Pinto
2014-04-16 17:29 ` [PATCH 014/14] t9362-mw-to-git-utf8.sh: " Elia Pinto
2014-04-17 9:00 ` [PATCH 001/14] howto-index.sh: " Matthieu Moy
2014-04-17 18:25 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1397669398-25410-5-git-send-email-gitter.spiros@gmail.com \
--to=gitter.spiros@gmail.com \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).