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

Commit 75ee3d7

Browse files
devzero2000gitster
authored andcommitted
git-am.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]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent b09d855 commit 75ee3d7

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

git-am.sh

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ cannot_fallback () {
125125
}
126126

127127
fall_back_3way () {
128-
O_OBJECT=`cd "$GIT_OBJECT_DIRECTORY" && pwd`
128+
O_OBJECT=$(cd "$GIT_OBJECT_DIRECTORY" && pwd)
129129

130130
rm -fr "$dotest"/patch-merge-*
131131
mkdir "$dotest/patch-merge-tmp-dir"
@@ -275,7 +275,7 @@ split_patches () {
275275
then
276276
clean_abort "$(gettext "Only one StGIT patch series can be applied at once")"
277277
fi
278-
series_dir=`dirname "$1"`
278+
series_dir=$(dirname "$1")
279279
series_file="$1"
280280
shift
281281
{
@@ -298,8 +298,8 @@ split_patches () {
298298
this=0
299299
for stgit in "$@"
300300
do
301-
this=`expr "$this" + 1`
302-
msgnum=`printf "%0${prec}d" $this`
301+
this=$(expr "$this" + 1)
302+
msgnum=$(printf "%0${prec}d" $this)
303303
# Perl version of StGIT parse_patch. The first nonemptyline
304304
# not starting with Author, From or Date is the
305305
# subject, and the body starts with the next nonempty
@@ -644,26 +644,26 @@ fi
644644
git_apply_opt=$(cat "$dotest/apply-opt")
645645
if test "$(cat "$dotest/sign")" = t
646646
then
647-
SIGNOFF=`git var GIT_COMMITTER_IDENT | sed -e '
647+
SIGNOFF=$(git var GIT_COMMITTER_IDENT | sed -e '
648648
s/>.*/>/
649649
s/^/Signed-off-by: /'
650-
`
650+
)
651651
else
652652
SIGNOFF=
653653
fi
654654

655-
last=`cat "$dotest/last"`
656-
this=`cat "$dotest/next"`
655+
last=$(cat "$dotest/last")
656+
this=$(cat "$dotest/next")
657657
if test "$skip" = t
658658
then
659-
this=`expr "$this" + 1`
659+
this=$(expr "$this" + 1)
660660
resume=
661661
fi
662662

663663
while test "$this" -le "$last"
664664
do
665-
msgnum=`printf "%0${prec}d" $this`
666-
next=`expr "$this" + 1`
665+
msgnum=$(printf "%0${prec}d" $this)
666+
next=$(expr "$this" + 1)
667667
test -f "$dotest/$msgnum" || {
668668
resume=
669669
go_next
@@ -739,16 +739,16 @@ To restore the original branch and stop patching run \"\$cmdline --abort\"."
739739
'')
740740
if test '' != "$SIGNOFF"
741741
then
742-
LAST_SIGNED_OFF_BY=`
742+
LAST_SIGNED_OFF_BY=$(
743743
sed -ne '/^Signed-off-by: /p' \
744744
"$dotest/msg-clean" |
745745
sed -ne '$p'
746-
`
747-
ADD_SIGNOFF=`
746+
)
747+
ADD_SIGNOFF=$(
748748
test "$LAST_SIGNED_OFF_BY" = "$SIGNOFF" || {
749749
test '' = "$LAST_SIGNED_OFF_BY" && echo
750750
echo "$SIGNOFF"
751-
}`
751+
})
752752
else
753753
ADD_SIGNOFF=
754754
fi

0 commit comments

Comments
 (0)