mirror of
https://github.com/git/git
synced 2024-08-28 03:59:25 +00:00
git-clone.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:
parent
844cb24f28
commit
add77e8400
|
@ -40,7 +40,7 @@ eval "$(echo "$OPTIONS_SPEC" | git rev-parse --parseopt -- "$@" || echo exit $?)
|
||||||
|
|
||||||
get_repo_base() {
|
get_repo_base() {
|
||||||
(
|
(
|
||||||
cd "`/bin/pwd`" &&
|
cd "$(/bin/pwd)" &&
|
||||||
cd "$1" || cd "$1.git" &&
|
cd "$1" || cd "$1.git" &&
|
||||||
{
|
{
|
||||||
cd .git
|
cd .git
|
||||||
|
@ -50,7 +50,7 @@ get_repo_base() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ -n "$GIT_SSL_NO_VERIFY" -o \
|
if [ -n "$GIT_SSL_NO_VERIFY" -o \
|
||||||
"`git config --bool http.sslVerify`" = false ]; then
|
"$(git config --bool http.sslVerify)" = false ]; then
|
||||||
curl_extra_args="-k"
|
curl_extra_args="-k"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -70,7 +70,7 @@ clone_dumb_http () {
|
||||||
clone_tmp="$GIT_DIR/clone-tmp" &&
|
clone_tmp="$GIT_DIR/clone-tmp" &&
|
||||||
mkdir -p "$clone_tmp" || exit 1
|
mkdir -p "$clone_tmp" || exit 1
|
||||||
if [ -n "$GIT_CURL_FTP_NO_EPSV" -o \
|
if [ -n "$GIT_CURL_FTP_NO_EPSV" -o \
|
||||||
"`git config --bool http.noEPSV`" = true ]; then
|
"$(git config --bool http.noEPSV)" = true ]; then
|
||||||
curl_extra_args="${curl_extra_args} --disable-epsv"
|
curl_extra_args="${curl_extra_args} --disable-epsv"
|
||||||
fi
|
fi
|
||||||
http_fetch "$1/info/refs" "$clone_tmp/refs" ||
|
http_fetch "$1/info/refs" "$clone_tmp/refs" ||
|
||||||
|
@ -79,7 +79,7 @@ Perhaps git-update-server-info needs to be run there?"
|
||||||
test "z$quiet" = z && v=-v || v=
|
test "z$quiet" = z && v=-v || v=
|
||||||
while read sha1 refname
|
while read sha1 refname
|
||||||
do
|
do
|
||||||
name=`expr "z$refname" : 'zrefs/\(.*\)'` &&
|
name=$(expr "z$refname" : 'zrefs/\(.*\)') &&
|
||||||
case "$name" in
|
case "$name" in
|
||||||
*^*) continue;;
|
*^*) continue;;
|
||||||
esac
|
esac
|
||||||
|
@ -88,7 +88,7 @@ Perhaps git-update-server-info needs to be run there?"
|
||||||
*) continue ;;
|
*) continue ;;
|
||||||
esac
|
esac
|
||||||
if test -n "$use_separate_remote" &&
|
if test -n "$use_separate_remote" &&
|
||||||
branch_name=`expr "z$name" : 'zheads/\(.*\)'`
|
branch_name=$(expr "z$name" : 'zheads/\(.*\)')
|
||||||
then
|
then
|
||||||
tname="remotes/$origin/$branch_name"
|
tname="remotes/$origin/$branch_name"
|
||||||
else
|
else
|
||||||
|
@ -100,7 +100,7 @@ Perhaps git-update-server-info needs to be run there?"
|
||||||
http_fetch "$1/HEAD" "$GIT_DIR/REMOTE_HEAD" ||
|
http_fetch "$1/HEAD" "$GIT_DIR/REMOTE_HEAD" ||
|
||||||
rm -f "$GIT_DIR/REMOTE_HEAD"
|
rm -f "$GIT_DIR/REMOTE_HEAD"
|
||||||
if test -f "$GIT_DIR/REMOTE_HEAD"; then
|
if test -f "$GIT_DIR/REMOTE_HEAD"; then
|
||||||
head_sha1=`cat "$GIT_DIR/REMOTE_HEAD"`
|
head_sha1=$(cat "$GIT_DIR/REMOTE_HEAD")
|
||||||
case "$head_sha1" in
|
case "$head_sha1" in
|
||||||
'ref: refs/'*)
|
'ref: refs/'*)
|
||||||
;;
|
;;
|
||||||
|
@ -444,15 +444,15 @@ then
|
||||||
# a non-bare repository is always in separate-remote layout
|
# a non-bare repository is always in separate-remote layout
|
||||||
remote_top="refs/remotes/$origin"
|
remote_top="refs/remotes/$origin"
|
||||||
head_sha1=
|
head_sha1=
|
||||||
test ! -r "$GIT_DIR/REMOTE_HEAD" || head_sha1=`cat "$GIT_DIR/REMOTE_HEAD"`
|
test ! -r "$GIT_DIR/REMOTE_HEAD" || head_sha1=$(cat "$GIT_DIR/REMOTE_HEAD")
|
||||||
case "$head_sha1" in
|
case "$head_sha1" in
|
||||||
'ref: refs/'*)
|
'ref: refs/'*)
|
||||||
# Uh-oh, the remote told us (http transport done against
|
# Uh-oh, the remote told us (http transport done against
|
||||||
# new style repository with a symref HEAD).
|
# new style repository with a symref HEAD).
|
||||||
# Ideally we should skip the guesswork but for now
|
# Ideally we should skip the guesswork but for now
|
||||||
# opt for minimum change.
|
# opt for minimum change.
|
||||||
head_sha1=`expr "z$head_sha1" : 'zref: refs/heads/\(.*\)'`
|
head_sha1=$(expr "z$head_sha1" : 'zref: refs/heads/\(.*\)')
|
||||||
head_sha1=`cat "$GIT_DIR/$remote_top/$head_sha1"`
|
head_sha1=$(cat "$GIT_DIR/$remote_top/$head_sha1")
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
@ -467,7 +467,7 @@ then
|
||||||
while read name
|
while read name
|
||||||
do
|
do
|
||||||
test t = $done && continue
|
test t = $done && continue
|
||||||
branch_tip=`cat "$GIT_DIR/$remote_top/$name"`
|
branch_tip=$(cat "$GIT_DIR/$remote_top/$name")
|
||||||
if test "$head_sha1" = "$branch_tip"
|
if test "$head_sha1" = "$branch_tip"
|
||||||
then
|
then
|
||||||
echo "$name"
|
echo "$name"
|
||||||
|
|
Loading…
Reference in a new issue