Merge branch 'ep/shell-command-substitution'

* ep/shell-command-substitution:
  t9362-mw-to-git-utf8.sh: use the $( ... ) construct for command substitution
  t9360-mw-to-git-clone.sh: use the $( ... ) construct for command substitution
  git-tag.sh: use the $( ... ) construct for command substitution
  git-revert.sh: use the $( ... ) construct for command substitution
  git-resolve.sh: use the $( ... ) construct for command substitution
  git-repack.sh: use the $( ... ) construct for command substitution
  git-merge.sh: use the $( ... ) construct for command substitution
  git-ls-remote.sh: use the $( ... ) construct for command substitution
  git-fetch.sh: use the $( ... ) construct for command substitution
  git-commit.sh: use the $( ... ) construct for command substitution
  git-clone.sh: use the $( ... ) construct for command substitution
  git-checkout.sh: use the $( ... ) construct for command substitution
  install-webdoc.sh: use the $( ... ) construct for command substitution
  howto-index.sh: use the $( ... ) construct for command substitution
This commit is contained in:
Junio C Hamano 2014-04-21 10:42:41 -07:00
commit 0e6e1a5fbd
14 changed files with 48 additions and 48 deletions

View file

@ -11,8 +11,8 @@ EOF
for txt for txt
do do
title=`expr "$txt" : '.*/\(.*\)\.txt$'` title=$(expr "$txt" : '.*/\(.*\)\.txt$')
from=`sed -ne ' from=$(sed -ne '
/^$/q /^$/q
/^From:[ ]/{ /^From:[ ]/{
s/// s///
@ -21,9 +21,9 @@ do
s/^/by / s/^/by /
p p
} }
' "$txt"` ' "$txt")
abstract=`sed -ne ' abstract=$(sed -ne '
/^Abstract:[ ]/{ /^Abstract:[ ]/{
s/^[^ ]*// s/^[^ ]*//
x x
@ -39,11 +39,11 @@ do
x x
p p
q q
}' "$txt"` }' "$txt")
if grep 'Content-type: text/asciidoc' >/dev/null $txt if grep 'Content-type: text/asciidoc' >/dev/null $txt
then then
file=`expr "$txt" : '\(.*\)\.txt$'`.html file=$(expr "$txt" : '\(.*\)\.txt$').html
else else
file="$txt" file="$txt"
fi fi

View file

@ -18,17 +18,17 @@ do
else else
echo >&2 "# install $h $T/$h" echo >&2 "# install $h $T/$h"
rm -f "$T/$h" rm -f "$T/$h"
mkdir -p `dirname "$T/$h"` mkdir -p $(dirname "$T/$h")
cp "$h" "$T/$h" cp "$h" "$T/$h"
fi fi
done done
strip_leading=`echo "$T/" | sed -e 's|.|.|g'` strip_leading=$(echo "$T/" | sed -e 's|.|.|g')
for th in \ for th in \
"$T"/*.html "$T"/*.txt \ "$T"/*.html "$T"/*.txt \
"$T"/howto/*.txt "$T"/howto/*.html \ "$T"/howto/*.txt "$T"/howto/*.html \
"$T"/technical/*.txt "$T"/technical/*.html "$T"/technical/*.txt "$T"/technical/*.html
do do
h=`expr "$th" : "$strip_leading"'\(.*\)'` h=$(expr "$th" : "$strip_leading"'\(.*\)')
case "$h" in case "$h" in
RelNotes-*.txt | index.html) continue ;; RelNotes-*.txt | index.html) continue ;;
esac esac

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"

View file

@ -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"

View file

@ -91,7 +91,7 @@ signoff=
force_author= force_author=
only_include_assumed= only_include_assumed=
untracked_files= untracked_files=
templatefile="`git config commit.template`" templatefile="$(git config commit.template)"
while test $# != 0 while test $# != 0
do do
case "$1" in case "$1" in
@ -350,7 +350,7 @@ t,)
TMP_INDEX="$GIT_DIR/tmp-index$$" TMP_INDEX="$GIT_DIR/tmp-index$$"
W= W=
test -z "$initial_commit" && W=--with-tree=HEAD 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 # Build a temporary index and update the real index
# the same way. # the same way.
@ -475,8 +475,8 @@ then
fi fi
if test '' != "$force_author" if test '' != "$force_author"
then then
GIT_AUTHOR_NAME=`expr "z$force_author" : 'z\(.*[^ ]\) *<.*'` && GIT_AUTHOR_NAME=$(expr "z$force_author" : 'z\(.*[^ ]\) *<.*') &&
GIT_AUTHOR_EMAIL=`expr "z$force_author" : '.*\(<.*\)'` && GIT_AUTHOR_EMAIL=$(expr "z$force_author" : '.*\(<.*\)') &&
test '' != "$GIT_AUTHOR_NAME" && test '' != "$GIT_AUTHOR_NAME" &&
test '' != "$GIT_AUTHOR_EMAIL" || test '' != "$GIT_AUTHOR_EMAIL" ||
die "malformed --author parameter" die "malformed --author parameter"
@ -489,7 +489,7 @@ then
rloga='commit' rloga='commit'
if [ -f "$GIT_DIR/MERGE_HEAD" ]; then if [ -f "$GIT_DIR/MERGE_HEAD" ]; then
rloga='commit (merge)' 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 elif test -n "$amend"; then
rloga='commit (amend)' rloga='commit (amend)'
PARENTS=$(git cat-file commit HEAD | PARENTS=$(git cat-file commit HEAD |

View file

@ -67,7 +67,7 @@ do
keep='-k -k' keep='-k -k'
;; ;;
--depth=*) --depth=*)
shallow_depth="--depth=`expr "z$1" : 'z-[^=]*=\(.*\)'`" shallow_depth="--depth=$(expr "z$1" : 'z-[^=]*=\(.*\)')"
;; ;;
--depth) --depth)
shift shift
@ -262,12 +262,12 @@ fetch_per_ref () {
http://* | https://* | ftp://*) http://* | https://* | ftp://*)
test -n "$shallow_depth" && test -n "$shallow_depth" &&
die "shallow clone with http not supported" die "shallow clone with http not supported"
proto=`expr "$remote" : '\([^:]*\):'` proto=$(expr "$remote" : '\([^:]*\):')
if [ -n "$GIT_SSL_NO_VERIFY" ]; then if [ -n "$GIT_SSL_NO_VERIFY" ]; then
curl_extra_args="-k" curl_extra_args="-k"
fi fi
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
noepsv_opt="--disable-epsv" noepsv_opt="--disable-epsv"
fi fi

View file

@ -55,11 +55,11 @@ tmpdir=$tmp-d
case "$peek_repo" in case "$peek_repo" in
http://* | https://* | ftp://* ) http://* | https://* | ftp://* )
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
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
curl -nsf $curl_extra_args --header "Pragma: no-cache" "$peek_repo/info/refs" || curl -nsf $curl_extra_args --header "Pragma: no-cache" "$peek_repo/info/refs" ||

View file

@ -341,7 +341,7 @@ case "$use_strategies" in
'') '')
case "$#" in case "$#" in
1) 1)
var="`git config --get pull.twohead`" var="$(git config --get pull.twohead)"
if test -n "$var" if test -n "$var"
then then
use_strategies="$var" use_strategies="$var"
@ -349,7 +349,7 @@ case "$use_strategies" in
use_strategies="$default_twohead_strategies" use_strategies="$default_twohead_strategies"
fi ;; fi ;;
*) *)
var="`git config --get pull.octopus`" var="$(git config --get pull.octopus)"
if test -n "$var" if test -n "$var"
then then
use_strategies="$var" use_strategies="$var"

View file

@ -49,7 +49,7 @@ do
shift shift
done done
case "`git config --bool repack.usedeltabaseoffset || echo true`" in case "$(git config --bool repack.usedeltabaseoffset || echo true)" in
true) true)
extra="$extra --delta-base-offset" ;; extra="$extra --delta-base-offset" ;;
esac esac

View file

@ -75,7 +75,7 @@ case "$common" in
GIT_INDEX_FILE=$G git read-tree -m $c $head $merge \ GIT_INDEX_FILE=$G git read-tree -m $c $head $merge \
2>/dev/null || continue 2>/dev/null || continue
# Count the paths that are unmerged. # Count the paths that are unmerged.
cnt=`GIT_INDEX_FILE=$G git ls-files --unmerged | wc -l` cnt=$(GIT_INDEX_FILE=$G git ls-files --unmerged | wc -l)
if test $best_cnt -le 0 -o $cnt -le $best_cnt if test $best_cnt -le 0 -o $cnt -le $best_cnt
then then
best=$c best=$c

View file

@ -137,7 +137,7 @@ cherry-pick)
q q
}' }'
logmsg=`git show -s --pretty=raw --encoding="$encoding" "$commit"` logmsg=$(git show -s --pretty=raw --encoding="$encoding" "$commit")
set_author_env=`echo "$logmsg" | set_author_env=`echo "$logmsg" |
LANG=C LC_ALL=C sed -ne "$pick_author_script"` LANG=C LC_ALL=C sed -ne "$pick_author_script"`
eval "$set_author_env" eval "$set_author_env"

View file

@ -156,7 +156,7 @@ prev=0000000000000000000000000000000000000000
if git show-ref --verify --quiet -- "refs/tags/$name" if git show-ref --verify --quiet -- "refs/tags/$name"
then then
test -n "$force" || die "tag '$name' already exists" test -n "$force" || die "tag '$name' already exists"
prev=`git rev-parse "refs/tags/$name"` prev=$(git rev-parse "refs/tags/$name")
fi fi
shift shift
git check-ref-format "tags/$name" || git check-ref-format "tags/$name" ||

View file

@ -191,10 +191,10 @@ test_expect_success 'Git clone works with the shallow option' '
test_path_is_file mw_dir_11/Main_Page.mw && test_path_is_file mw_dir_11/Main_Page.mw &&
( (
cd mw_dir_11 && cd mw_dir_11 &&
test `git log --oneline Nyan.mw | wc -l` -eq 1 && test $(git log --oneline Nyan.mw | wc -l) -eq 1 &&
test `git log --oneline Foo.mw | wc -l` -eq 1 && test $(git log --oneline Foo.mw | wc -l) -eq 1 &&
test `git log --oneline Bar.mw | wc -l` -eq 1 && test $(git log --oneline Bar.mw | wc -l) -eq 1 &&
test `git log --oneline Main_Page.mw | wc -l ` -eq 1 test $(git log --oneline Main_Page.mw | wc -l ) -eq 1
) && ) &&
wiki_check_content mw_dir_11/Nyan.mw Nyan && wiki_check_content mw_dir_11/Nyan.mw Nyan &&
wiki_check_content mw_dir_11/Foo.mw Foo && wiki_check_content mw_dir_11/Foo.mw Foo &&
@ -218,9 +218,9 @@ test_expect_success 'Git clone works with the shallow option with a delete page'
test_path_is_file mw_dir_12/Main_Page.mw && test_path_is_file mw_dir_12/Main_Page.mw &&
( (
cd mw_dir_12 && cd mw_dir_12 &&
test `git log --oneline Nyan.mw | wc -l` -eq 1 && test $(git log --oneline Nyan.mw | wc -l) -eq 1 &&
test `git log --oneline Bar.mw | wc -l` -eq 1 && test $(git log --oneline Bar.mw | wc -l) -eq 1 &&
test `git log --oneline Main_Page.mw | wc -l ` -eq 1 test $(git log --oneline Main_Page.mw | wc -l ) -eq 1
) && ) &&
wiki_check_content mw_dir_12/Nyan.mw Nyan && wiki_check_content mw_dir_12/Nyan.mw Nyan &&
wiki_check_content mw_dir_12/Bar.mw Bar && wiki_check_content mw_dir_12/Bar.mw Bar &&

View file

@ -70,8 +70,8 @@ test_expect_success 'The shallow option works with accents' '
test_path_is_file mw_dir_4/Main_Page.mw && test_path_is_file mw_dir_4/Main_Page.mw &&
( (
cd mw_dir_4 && cd mw_dir_4 &&
test `git log --oneline Néoà.mw | wc -l` -eq 1 && test $(git log --oneline Néoà.mw | wc -l) -eq 1 &&
test `git log --oneline Main_Page.mw | wc -l ` -eq 1 test $(git log --oneline Main_Page.mw | wc -l ) -eq 1
) && ) &&
wiki_check_content mw_dir_4/Néoà.mw Néoà && wiki_check_content mw_dir_4/Néoà.mw Néoà &&
wiki_check_content mw_dir_4/Main_Page.mw Main_Page wiki_check_content mw_dir_4/Main_Page.mw Main_Page