Skip to content

Commit bc32bac

Browse files
devzero2000gitster
authored andcommitted
contrib/examples/git-revert.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 perl -i -pe 'BEGIN{undef $/;} s/`(.+?)`/\$(\1)/smg' "${_f}" done and then carefully proof-read. Signed-off-by: Elia Pinto <gitter.spiros@gmail.com> Reviewed-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent 6ccca67 commit bc32bac

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

contrib/examples/git-revert.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,8 @@ cherry-pick)
138138
}'
139139

140140
logmsg=$(git show -s --pretty=raw --encoding="$encoding" "$commit")
141-
set_author_env=`echo "$logmsg" |
142-
LANG=C LC_ALL=C sed -ne "$pick_author_script"`
141+
set_author_env=$(echo "$logmsg" |
142+
LANG=C LC_ALL=C sed -ne "$pick_author_script")
143143
eval "$set_author_env"
144144
export GIT_AUTHOR_NAME
145145
export GIT_AUTHOR_EMAIL
@@ -160,9 +160,9 @@ cherry-pick)
160160
esac >.msg
161161

162162
eval GITHEAD_$head=HEAD
163-
eval GITHEAD_$next='`git show -s \
163+
eval GITHEAD_$next='$(git show -s \
164164
--pretty=oneline --encoding="$encoding" "$commit" |
165-
sed -e "s/^[^ ]* //"`'
165+
sed -e "s/^[^ ]* //")'
166166
export GITHEAD_$head GITHEAD_$next
167167

168168
# This three way merge is an interesting one. We are at

0 commit comments

Comments
 (0)