Skip to content

Commit

Permalink
Merge branch 'ep/shell-command-substitution'
Browse files Browse the repository at this point in the history
Adjust shell scripts to use $(cmd) instead of `cmd`.

* ep/shell-command-substitution: (41 commits)
  t5000-tar-tree.sh: use the $( ... ) construct for command substitution
  t4204-patch-id.sh: use the $( ... ) construct for command substitution
  t4119-apply-config.sh: use the $( ... ) construct for command substitution
  t4116-apply-reverse.sh: use the $( ... ) construct for command substitution
  t4057-diff-combined-paths.sh: use the $( ... ) construct for command substitution
  t4038-diff-combined.sh: use the $( ... ) construct for command substitution
  t4036-format-patch-signer-mime.sh: use the $( ... ) construct for command substitution
  t4014-format-patch.sh: use the $( ... ) construct for command substitution
  t4013-diff-various.sh: use the $( ... ) construct for command substitution
  t4012-diff-binary.sh: use the $( ... ) construct for command substitution
  t4010-diff-pathspec.sh: use the $( ... ) construct for command substitution
  t4006-diff-mode.sh: use the $( ... ) construct for command substitution
  t3910-mac-os-precompose.sh: use the $( ... ) construct for command substitution
  t3905-stash-include-untracked.sh: use the $( ... ) construct for command substitution
  t1050-large.sh: use the $( ... ) construct for command substitution
  t1020-subdirectory.sh: use the $( ... ) construct for command substitution
  t1004-read-tree-m-u-wf.sh: use the $( ... ) construct for command substitution
  t1003-read-tree-prefix.sh: use the $( ... ) construct for command substitution
  t1002-read-tree-m-u-2way.sh: use the $( ... ) construct for command substitution
  t1001-read-tree-m-2way.sh: use the $( ... ) construct for command substitution
  ...
  • Loading branch information
Junio C Hamano committed Jun 3, 2014
2 parents 6d3c4e9 + f5efd51 commit 6753d8a
Show file tree
Hide file tree
Showing 41 changed files with 174 additions and 174 deletions.
2 changes: 1 addition & 1 deletion contrib/mw-to-git/t/t9365-continuing-queries.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ test_check_precond

test_expect_success 'creating page w/ >500 revisions' '
wiki_reset &&
for i in `test_seq 501`
for i in $(test_seq 501)
do
echo "creating revision $i" &&
wiki_editpage foo "revision $i<br/>" true
Expand Down
6 changes: 3 additions & 3 deletions contrib/mw-to-git/t/test-gitmw-lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ test_diff_directories () {
#
# Check that <dir> contains exactly <N> files
test_contains_N_files () {
if test `ls -- "$1" | wc -l` -ne "$2"; then
if test $(ls -- "$1" | wc -l) -ne "$2"; then
echo "directory $1 should contain $2 files"
echo "it contains these files:"
ls "$1"
Expand Down Expand Up @@ -340,10 +340,10 @@ wiki_install () {
"http://download.wikimedia.org/mediawiki/$MW_VERSION_MAJOR/"\
"$MW_FILENAME. "\
"Please fix your connection and launch the script again."
echo "$MW_FILENAME downloaded in `pwd`. "\
echo "$MW_FILENAME downloaded in $(pwd). "\
"You can delete it later if you want."
else
echo "Reusing existing $MW_FILENAME downloaded in `pwd`."
echo "Reusing existing $MW_FILENAME downloaded in $(pwd)."
fi
archive_abs_path=$(pwd)/$MW_FILENAME
cd "$WIKI_DIR_INST/$WIKI_DIR_NAME/" ||
Expand Down
2 changes: 1 addition & 1 deletion contrib/subtree/t/t7900-subtree.sh
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ test_expect_success 'add sub1' '

# Save this hash for testing later.

subdir_hash=`git rev-parse HEAD`
subdir_hash=$(git rev-parse HEAD)

test_expect_success 'add sub2' '
create sub2 &&
Expand Down
14 changes: 7 additions & 7 deletions contrib/thunderbird-patch-inline/appp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ CONFFILE=~/.appprc

SEP="-=-=-=-=-=-=-=-=-=# Don't remove this line #=-=-=-=-=-=-=-=-=-"
if [ -e "$CONFFILE" ] ; then
LAST_DIR=`grep -m 1 "^LAST_DIR=" "${CONFFILE}"|sed -e 's/^LAST_DIR=//'`
LAST_DIR=$(grep -m 1 "^LAST_DIR=" "${CONFFILE}"|sed -e 's/^LAST_DIR=//')
cd "${LAST_DIR}"
else
cd > /dev/null
Expand All @@ -25,11 +25,11 @@ fi

cd - > /dev/null

SUBJECT=`sed -n -e '/^Subject: /p' "${PATCH}"`
HEADERS=`sed -e '/^'"${SEP}"'$/,$d' $1`
BODY=`sed -e "1,/${SEP}/d" $1`
CMT_MSG=`sed -e '1,/^$/d' -e '/^---$/,$d' "${PATCH}"`
DIFF=`sed -e '1,/^---$/d' "${PATCH}"`
SUBJECT=$(sed -n -e '/^Subject: /p' "${PATCH}")
HEADERS=$(sed -e '/^'"${SEP}"'$/,$d' $1)
BODY=$(sed -e "1,/${SEP}/d" $1)
CMT_MSG=$(sed -e '1,/^$/d' -e '/^---$/,$d' "${PATCH}")
DIFF=$(sed -e '1,/^---$/d' "${PATCH}")

CCS=`echo -e "$CMT_MSG\n$HEADERS" | sed -n -e 's/^Cc: \(.*\)$/\1,/gp' \
-e 's/^Signed-off-by: \(.*\)/\1,/gp'`
Expand All @@ -48,7 +48,7 @@ if [ "x${BODY}x" != "xx" ] ; then
fi
echo "$DIFF" >> $1

LAST_DIR=`dirname "${PATCH}"`
LAST_DIR=$(dirname "${PATCH}")

grep -v "^LAST_DIR=" "${CONFFILE}" > "${CONFFILE}_"
echo "LAST_DIR=${LAST_DIR}" >> "${CONFFILE}_"
Expand Down
2 changes: 1 addition & 1 deletion git-pull.sh
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ do
-s|--s|--st|--str|--stra|--strat|--strate|--strateg|--strategy)
case "$#,$1" in
*,*=*)
strategy=`expr "z$1" : 'z-[^=]*=\(.*\)'` ;;
strategy=$(expr "z$1" : 'z-[^=]*=\(.*\)') ;;
1,*)
usage ;;
*)
Expand Down
4 changes: 2 additions & 2 deletions git-rebase--merge.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ continue_merge () {
die "$resolvemsg"
fi

cmt=`cat "$state_dir/current"`
cmt=$(cat "$state_dir/current")
if ! git diff-index --quiet --ignore-submodules HEAD --
then
if ! git commit ${gpg_sign_opt:+"$gpg_sign_opt"} --no-verify -C "$cmt"
Expand Down Expand Up @@ -143,7 +143,7 @@ echo "$onto_name" > "$state_dir/onto_name"
write_basic_state

msgnum=0
for cmt in `git rev-list --reverse --no-merges "$revisions"`
for cmt in $(git rev-list --reverse --no-merges "$revisions")
do
msgnum=$(($msgnum + 1))
echo "$cmt" > "$state_dir/cmt.$msgnum"
Expand Down
8 changes: 4 additions & 4 deletions git-rebase.sh
Original file line number Diff line number Diff line change
Expand Up @@ -457,8 +457,8 @@ then
else
if test -z "$onto"
then
empty_tree=`git hash-object -t tree /dev/null`
onto=`git commit-tree $empty_tree </dev/null`
empty_tree=$(git hash-object -t tree /dev/null)
onto=$(git commit-tree $empty_tree </dev/null)
squash_onto="$onto"
fi
unset upstream_name
Expand Down Expand Up @@ -516,10 +516,10 @@ case "$#" in
;;
0)
# Do not need to switch branches, we are already on it.
if branch_name=`git symbolic-ref -q HEAD`
if branch_name=$(git symbolic-ref -q HEAD)
then
head_name=$branch_name
branch_name=`expr "z$branch_name" : 'zrefs/heads/\(.*\)'`
branch_name=$(expr "z$branch_name" : 'zrefs/heads/\(.*\)')
else
head_name="detached HEAD"
branch_name=HEAD ;# detached
Expand Down
2 changes: 1 addition & 1 deletion git-stash.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ USAGE="list [<options>]

SUBDIRECTORY_OK=Yes
OPTIONS_SPEC=
START_DIR=`pwd`
START_DIR=$(pwd)
. git-sh-setup
. git-sh-i18n
require_work_tree
Expand Down
6 changes: 3 additions & 3 deletions git-web--browse.sh
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ do
-b|--browser*|-t|--tool*)
case "$#,$1" in
*,*=*)
browser=`expr "z$1" : 'z-[^=]*=\(.*\)'`
browser=$(expr "z$1" : 'z-[^=]*=\(.*\)')
;;
1,*)
usage ;;
Expand All @@ -71,7 +71,7 @@ do
-c|--config*)
case "$#,$1" in
*,*=*)
conf=`expr "z$1" : 'z-[^=]*=\(.*\)'`
conf=$(expr "z$1" : 'z-[^=]*=\(.*\)')
;;
1,*)
usage ;;
Expand Down Expand Up @@ -100,7 +100,7 @@ then
for opt in "$conf" "web.browser"
do
test -z "$opt" && continue
browser="`git config $opt`"
browser="$(git config $opt)"
test -z "$browser" || break
done
if test -n "$browser" && ! valid_tool "$browser"; then
Expand Down
2 changes: 1 addition & 1 deletion t/lib-credential.sh
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ helper_test_timeout() {
cat >askpass <<\EOF
#!/bin/sh
echo >&2 askpass: $*
what=`echo $1 | cut -d" " -f1 | tr A-Z a-z | tr -cd a-z`
what=$(echo $1 | cut -d" " -f1 | tr A-Z a-z | tr -cd a-z)
echo "askpass-$what"
EOF
chmod +x askpass
Expand Down
2 changes: 1 addition & 1 deletion t/lib-cvs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ fi
CVS="cvs -f"
export CVS

cvsps_version=`cvsps -h 2>&1 | sed -ne 's/cvsps version //p'`
cvsps_version=$(cvsps -h 2>&1 | sed -ne 's/cvsps version //p')
case "$cvsps_version" in
2.1 | 2.2*)
;;
Expand Down
2 changes: 1 addition & 1 deletion t/lib-gpg.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/sh

gpg_version=`gpg --version 2>&1`
gpg_version=$(gpg --version 2>&1)
if test $? = 127; then
say "You do not seem to have gpg installed"
else
Expand Down
2 changes: 1 addition & 1 deletion t/perf/p5302-pack-index.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ test_perf_large_repo

test_expect_success 'repack' '
git repack -ad &&
PACK=`ls .git/objects/pack/*.pack | head -n1` &&
PACK=$(ls .git/objects/pack/*.pack | head -n1) &&
test -f "$PACK" &&
export PACK
'
Expand Down
12 changes: 6 additions & 6 deletions t/t0001-init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -185,14 +185,14 @@ test_expect_success 'init --bare/--shared overrides system/global config' '
git init --bare --shared=0666 init-bare-shared-override &&
check_config init-bare-shared-override true unset &&
test x0666 = \
x`git config -f init-bare-shared-override/config core.sharedRepository`
x$(git config -f init-bare-shared-override/config core.sharedRepository)
'

test_expect_success 'init honors global core.sharedRepository' '
test_config_global core.sharedRepository 0666 &&
git init shared-honor-global &&
test x0666 = \
x`git config -f shared-honor-global/.git/config core.sharedRepository`
x$(git config -f shared-honor-global/.git/config core.sharedRepository)
'

test_expect_success 'init rejects insanely long --template' '
Expand Down Expand Up @@ -285,7 +285,7 @@ test_expect_success 'init prefers command line to GIT_DIR' '
test_expect_success 'init with separate gitdir' '
rm -rf newdir &&
git init --separate-git-dir realgitdir newdir &&
echo "gitdir: `pwd`/realgitdir" >expected &&
echo "gitdir: $(pwd)/realgitdir" >expected &&
test_cmp expected newdir/.git &&
test_path_is_dir realgitdir/refs
'
Expand All @@ -299,7 +299,7 @@ test_expect_success 're-init to update git link' '
cd newdir &&
git init --separate-git-dir ../surrealgitdir
) &&
echo "gitdir: `pwd`/surrealgitdir" >expected &&
echo "gitdir: $(pwd)/surrealgitdir" >expected &&
test_cmp expected newdir/.git &&
test_path_is_dir surrealgitdir/refs &&
test_path_is_missing realgitdir/refs
Expand All @@ -312,7 +312,7 @@ test_expect_success 're-init to move gitdir' '
cd newdir &&
git init --separate-git-dir ../realgitdir
) &&
echo "gitdir: `pwd`/realgitdir" >expected &&
echo "gitdir: $(pwd)/realgitdir" >expected &&
test_cmp expected newdir/.git &&
test_path_is_dir realgitdir/refs
'
Expand All @@ -326,7 +326,7 @@ test_expect_success SYMLINKS 're-init to move gitdir symlink' '
ln -s here .git &&
git init --separate-git-dir ../realgitdir
) &&
echo "gitdir: `pwd`/realgitdir" >expected &&
echo "gitdir: $(pwd)/realgitdir" >expected &&
test_cmp expected newdir/.git &&
test_cmp expected newdir/here &&
test_path_is_dir realgitdir/refs
Expand Down
4 changes: 2 additions & 2 deletions t/t0010-racy-git.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ do
git update-index --add infocom
echo xyzzy >infocom

files=`git diff-files -p`
files=$(git diff-files -p)
test_expect_success \
"Racy GIT trial #$trial part A" \
'test "" != "$files"'
Expand All @@ -23,7 +23,7 @@ do
echo xyzzy >cornerstone
git update-index --add cornerstone

files=`git diff-files -p`
files=$(git diff-files -p)
test_expect_success \
"Racy GIT trial #$trial part B" \
'test "" != "$files"'
Expand Down
42 changes: 21 additions & 21 deletions t/t0020-crlf.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@ test_expect_success setup '
git commit -m initial &&
one=`git rev-parse HEAD:one` &&
dir=`git rev-parse HEAD:dir` &&
two=`git rev-parse HEAD:dir/two` &&
three=`git rev-parse HEAD:three` &&
one=$(git rev-parse HEAD:one) &&
dir=$(git rev-parse HEAD:dir) &&
two=$(git rev-parse HEAD:dir/two) &&
three=$(git rev-parse HEAD:three) &&
for w in Some extra lines here; do echo $w; done >>one &&
git diff >patch.file &&
patched=`git hash-object --stdin <one` &&
patched=$(git hash-object --stdin <one) &&
git read-tree --reset -u HEAD &&
echo happy.
Expand Down Expand Up @@ -111,7 +111,7 @@ test_expect_success 'update with autocrlf=input' '
}
done &&
differs=`git diff-index --cached HEAD` &&
differs=$(git diff-index --cached HEAD) &&
test -z "$differs" || {
echo Oops "$differs"
false
Expand All @@ -135,7 +135,7 @@ test_expect_success 'update with autocrlf=true' '
}
done &&
differs=`git diff-index --cached HEAD` &&
differs=$(git diff-index --cached HEAD) &&
test -z "$differs" || {
echo Oops "$differs"
false
Expand All @@ -158,9 +158,9 @@ test_expect_success 'checkout with autocrlf=true' '
break
}
done &&
test "$one" = `git hash-object --stdin <one` &&
test "$two" = `git hash-object --stdin <dir/two` &&
differs=`git diff-index --cached HEAD` &&
test "$one" = $(git hash-object --stdin <one) &&
test "$two" = $(git hash-object --stdin <dir/two) &&
differs=$(git diff-index --cached HEAD) &&
test -z "$differs" || {
echo Oops "$differs"
false
Expand All @@ -184,9 +184,9 @@ test_expect_success 'checkout with autocrlf=input' '
git update-index -- $f
fi
done &&
test "$one" = `git hash-object --stdin <one` &&
test "$two" = `git hash-object --stdin <dir/two` &&
differs=`git diff-index --cached HEAD` &&
test "$one" = $(git hash-object --stdin <one) &&
test "$two" = $(git hash-object --stdin <dir/two) &&
differs=$(git diff-index --cached HEAD) &&
test -z "$differs" || {
echo Oops "$differs"
false
Expand All @@ -200,7 +200,7 @@ test_expect_success 'apply patch (autocrlf=input)' '
git read-tree --reset -u HEAD &&
git apply patch.file &&
test "$patched" = "`git hash-object --stdin <one`" || {
test "$patched" = "$(git hash-object --stdin <one)" || {
echo "Eh? apply without index"
false
}
Expand All @@ -213,7 +213,7 @@ test_expect_success 'apply patch --cached (autocrlf=input)' '
git read-tree --reset -u HEAD &&
git apply --cached patch.file &&
test "$patched" = `git rev-parse :one` || {
test "$patched" = $(git rev-parse :one) || {
echo "Eh? apply with --cached"
false
}
Expand All @@ -226,8 +226,8 @@ test_expect_success 'apply patch --index (autocrlf=input)' '
git read-tree --reset -u HEAD &&
git apply --index patch.file &&
test "$patched" = `git rev-parse :one` &&
test "$patched" = `git hash-object --stdin <one` || {
test "$patched" = $(git rev-parse :one) &&
test "$patched" = $(git hash-object --stdin <one) || {
echo "Eh? apply with --index"
false
}
Expand All @@ -240,7 +240,7 @@ test_expect_success 'apply patch (autocrlf=true)' '
git read-tree --reset -u HEAD &&
git apply patch.file &&
test "$patched" = "`remove_cr <one | git hash-object --stdin`" || {
test "$patched" = "$(remove_cr <one | git hash-object --stdin)" || {
echo "Eh? apply without index"
false
}
Expand All @@ -253,7 +253,7 @@ test_expect_success 'apply patch --cached (autocrlf=true)' '
git read-tree --reset -u HEAD &&
git apply --cached patch.file &&
test "$patched" = `git rev-parse :one` || {
test "$patched" = $(git rev-parse :one) || {
echo "Eh? apply without index"
false
}
Expand All @@ -266,8 +266,8 @@ test_expect_success 'apply patch --index (autocrlf=true)' '
git read-tree --reset -u HEAD &&
git apply --index patch.file &&
test "$patched" = `git rev-parse :one` &&
test "$patched" = "`remove_cr <one | git hash-object --stdin`" || {
test "$patched" = $(git rev-parse :one) &&
test "$patched" = "$(remove_cr <one | git hash-object --stdin)" || {
echo "Eh? apply with --index"
false
}
Expand Down
Loading

0 comments on commit 6753d8a

Please sign in to comment.