git-checkout.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>
This commit is contained in:
Elia Pinto 2014-04-16 10:29:47 -07:00 committed by Junio C Hamano
parent 2c4a050bc6
commit 844cb24f28

View file

@ -222,7 +222,7 @@ else
# Match the index to the working tree, and do a three-way. # Match the index to the working tree, and do a three-way.
git diff-files --name-only | git update-index --remove --stdin && git diff-files --name-only | git update-index --remove --stdin &&
work=`git write-tree` && work=$(git write-tree) &&
git read-tree $v --reset -u $new || exit git read-tree $v --reset -u $new || exit
eval GITHEAD_$new='${new_name:-${branch:-$new}}' && eval GITHEAD_$new='${new_name:-${branch:-$new}}' &&
@ -233,7 +233,7 @@ else
# Do not register the cleanly merged paths in the index yet. # Do not register the cleanly merged paths in the index yet.
# this is not a real merge before committing, but just carrying # this is not a real merge before committing, but just carrying
# the working tree changes along. # the working tree changes along.
unmerged=`git ls-files -u` unmerged=$(git ls-files -u)
git read-tree $v --reset $new git read-tree $v --reset $new
case "$unmerged" in case "$unmerged" in
'') ;; '') ;;
@ -269,7 +269,7 @@ if [ "$?" -eq 0 ]; then
fi fi
if test -n "$branch" if test -n "$branch"
then then
old_branch_name=`expr "z$oldbranch" : 'zrefs/heads/\(.*\)'` old_branch_name=$(expr "z$oldbranch" : 'zrefs/heads/\(.*\)')
GIT_DIR="$GIT_DIR" git symbolic-ref -m "checkout: moving from ${old_branch_name:-$old} to $branch" HEAD "refs/heads/$branch" GIT_DIR="$GIT_DIR" git symbolic-ref -m "checkout: moving from ${old_branch_name:-$old} to $branch" HEAD "refs/heads/$branch"
if test -n "$quiet" if test -n "$quiet"
then then
@ -282,7 +282,7 @@ if [ "$?" -eq 0 ]; then
fi fi
elif test -n "$detached" elif test -n "$detached"
then then
old_branch_name=`expr "z$oldbranch" : 'zrefs/heads/\(.*\)'` old_branch_name=$(expr "z$oldbranch" : 'zrefs/heads/\(.*\)')
git update-ref --no-deref -m "checkout: moving from ${old_branch_name:-$old} to $arg" HEAD "$detached" || git update-ref --no-deref -m "checkout: moving from ${old_branch_name:-$old} to $arg" HEAD "$detached" ||
die "Cannot detach HEAD" die "Cannot detach HEAD"
if test -n "$detach_warn" if test -n "$detach_warn"