Skip to content

Commit

Permalink
Merge branch 'ep/shell-command-substitution-style'
Browse files Browse the repository at this point in the history
A shell script style update to change `command substitution` into
$(command substitution).  Coverts contrib/ and much of the t/
directory contents.

* ep/shell-command-substitution-style: (92 commits)
  t9901-git-web--browse.sh: use the $( ... ) construct for command substitution
  t9501-gitweb-standalone-http-status.sh: use the $( ... ) construct for command substitution
  t9350-fast-export.sh: use the $( ... ) construct for command substitution
  t9300-fast-import.sh: use the $( ... ) construct for command substitution
  t9150-svk-mergetickets.sh: use the $( ... ) construct for command substitution
  t9145-git-svn-master-branch.sh: use the $( ... ) construct for command substitution
  t9138-git-svn-authors-prog.sh: use the $( ... ) construct for command substitution
  t9137-git-svn-dcommit-clobber-series.sh: use the $( ... ) construct for command substitution
  t9132-git-svn-broken-symlink.sh: use the $( ... ) construct for command substitution
  t9130-git-svn-authors-file.sh: use the $( ... ) construct for command substitution
  t9129-git-svn-i18n-commitencoding.sh: use the $( ... ) construct for command substitution
  t9119-git-svn-info.sh: use the $( ... ) construct for command substitution
  t9118-git-svn-funky-branch-names.sh: use the $( ... ) construct for command substitution
  t9114-git-svn-dcommit-merge.sh: use the $( ... ) construct for command substitution
  t9110-git-svn-use-svm-props.sh: use the $( ... ) construct for command substitution
  t9109-git-svn-multi-glob.sh: use the $( ... ) construct for command substitution
  t9108-git-svn-glob.sh: use the $( ... ) construct for command substitution
  t9107-git-svn-migrate.sh: use the $( ... ) construct for command substitution
  t9105-git-svn-commit-diff.sh: use the $( ... ) construct for command substitution
  t9104-git-svn-follow-parent.sh: use the $( ... ) construct for command substitution
  ...
  • Loading branch information
Junio C Hamano committed Jan 22, 2016
2 parents a039a79 + ec1b763 commit e572fef
Show file tree
Hide file tree
Showing 91 changed files with 400 additions and 400 deletions.
8 changes: 4 additions & 4 deletions contrib/examples/git-commit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -574,10 +574,10 @@ then
if test "$templatefile" != ""
then
# Test whether this is just the unaltered template.
if cnt=`sed -e '/^#/d' < "$templatefile" |
if cnt=$(sed -e '/^#/d' < "$templatefile" |
git stripspace |
diff "$GIT_DIR"/COMMIT_BAREMSG - |
wc -l` &&
wc -l) &&
test 0 -lt $cnt
then
have_commitmsg=t
Expand Down Expand Up @@ -630,8 +630,8 @@ then
fi
if test -z "$quiet"
then
commit=`git diff-tree --always --shortstat --pretty="format:%h: %s"\
--abbrev --summary --root HEAD --`
commit=$(git diff-tree --always --shortstat --pretty="format:%h: %s"\
--abbrev --summary --root HEAD --)
echo "Created${initial_commit:+ initial} commit $commit"
fi
fi
Expand Down
4 changes: 2 additions & 2 deletions contrib/examples/git-fetch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -146,13 +146,13 @@ esac
reflist=$(get_remote_refs_for_fetch "$@")
if test "$tags"
then
taglist=`IFS=' ' &&
taglist=$(IFS=' ' &&
echo "$ls_remote_result" |
git show-ref --exclude-existing=refs/tags/ |
while read sha1 name
do
echo ".${name}:${name}"
done` || exit
done) || exit
if test "$#" -gt 1
then
# remote URL plus explicit refspecs; we need to merge them.
Expand Down
4 changes: 2 additions & 2 deletions contrib/examples/git-merge.sh
Original file line number Diff line number Diff line change
Expand Up @@ -523,10 +523,10 @@ do

if test "$exit" -eq 1
then
cnt=`{
cnt=$({
git diff-files --name-only
git ls-files --unmerged
} | wc -l`
} | wc -l)
if test $best_cnt -le 0 || test $cnt -le $best_cnt
then
best_strategy=$strategy
Expand Down
4 changes: 2 additions & 2 deletions contrib/examples/git-repack.sh
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ case ",$all_into_one," in
,t,)
args= existing=
if [ -d "$PACKDIR" ]; then
for e in `cd "$PACKDIR" && find . -type f -name '*.pack' \
| sed -e 's/^\.\///' -e 's/\.pack$//'`
for e in $(cd "$PACKDIR" && find . -type f -name '*.pack' \
| sed -e 's/^\.\///' -e 's/\.pack$//')
do
if [ -e "$PACKDIR/$e.keep" ]; then
: keep
Expand Down
8 changes: 4 additions & 4 deletions contrib/examples/git-revert.sh
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,8 @@ cherry-pick)
}'

logmsg=$(git show -s --pretty=raw --encoding="$encoding" "$commit")
set_author_env=`echo "$logmsg" |
LANG=C LC_ALL=C sed -ne "$pick_author_script"`
set_author_env=$(echo "$logmsg" |
LANG=C LC_ALL=C sed -ne "$pick_author_script")
eval "$set_author_env"
export GIT_AUTHOR_NAME
export GIT_AUTHOR_EMAIL
Expand All @@ -160,9 +160,9 @@ cherry-pick)
esac >.msg

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

# This three way merge is an interesting one. We are at
Expand Down
4 changes: 2 additions & 2 deletions contrib/thunderbird-patch-inline/appp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ 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'`
CCS=$(echo -e "$CMT_MSG\n$HEADERS" | sed -n -e 's/^Cc: \(.*\)$/\1,/gp' \
-e 's/^Signed-off-by: \(.*\)/\1,/gp')

echo "$SUBJECT" > $1
echo "Cc: $CCS" >> $1
Expand Down
4 changes: 2 additions & 2 deletions git-gui/po/glossary/txt-to-pot.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
if [ $# -eq 0 ]
then
cat <<!
Usage: `basename $0` git-gui-glossary.txt > git-gui-glossary.pot
Usage: $(basename $0) git-gui-glossary.txt > git-gui-glossary.pot
!
exit 1;
fi
Expand All @@ -33,7 +33,7 @@ cat <<!
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"POT-Creation-Date: `date +'%Y-%m-%d %H:%M%z'`\n"
"POT-Creation-Date: $(date +'%Y-%m-%d %H:%M%z')\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
Expand Down
4 changes: 2 additions & 2 deletions t/lib-httpd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,8 @@ then
test_skip_or_die $GIT_TEST_HTTPD "no web server found at '$LIB_HTTPD_PATH'"
fi

HTTPD_VERSION=`$LIB_HTTPD_PATH -v | \
sed -n 's/^Server version: Apache\/\([0-9]*\)\..*$/\1/p; q'`
HTTPD_VERSION=$($LIB_HTTPD_PATH -v | \
sed -n 's/^Server version: Apache\/\([0-9]*\)\..*$/\1/p; q')

if test -n "$HTTPD_VERSION"
then
Expand Down
4 changes: 2 additions & 2 deletions t/t1100-commit-tree-options.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ test_expect_success \
GIT_COMMITTER_NAME="Committer Name" \
GIT_COMMITTER_EMAIL="committer@email" \
GIT_COMMITTER_DATE="2005-05-26 23:30" \
TZ=GMT git commit-tree `cat treeid` >commitid 2>/dev/null'
TZ=GMT git commit-tree $(cat treeid) >commitid 2>/dev/null'

test_expect_success \
'read commit' \
'git cat-file commit `cat commitid` >commit'
'git cat-file commit $(cat commitid) >commit'

test_expect_success \
'compare commit' \
Expand Down
2 changes: 1 addition & 1 deletion t/t1401-symbolic-ref.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ reset_to_sane

test_expect_success 'symbolic-ref refuses bare sha1' '
echo content >file && git add file && git commit -m one &&
test_must_fail git symbolic-ref HEAD `git rev-parse HEAD`
test_must_fail git symbolic-ref HEAD $(git rev-parse HEAD)
'
reset_to_sane

Expand Down
24 changes: 12 additions & 12 deletions t/t1410-reflog.sh
Original file line number Diff line number Diff line change
Expand Up @@ -62,34 +62,34 @@ test_expect_success setup '
git add . &&
test_tick && git commit -m rabbit &&
H=`git rev-parse --verify HEAD` &&
A=`git rev-parse --verify HEAD:A` &&
B=`git rev-parse --verify HEAD:A/B` &&
C=`git rev-parse --verify HEAD:C` &&
D=`git rev-parse --verify HEAD:A/D` &&
E=`git rev-parse --verify HEAD:A/B/E` &&
H=$(git rev-parse --verify HEAD) &&
A=$(git rev-parse --verify HEAD:A) &&
B=$(git rev-parse --verify HEAD:A/B) &&
C=$(git rev-parse --verify HEAD:C) &&
D=$(git rev-parse --verify HEAD:A/D) &&
E=$(git rev-parse --verify HEAD:A/B/E) &&
check_fsck &&
test_chmod +x C &&
git add C &&
test_tick && git commit -m dragon &&
L=`git rev-parse --verify HEAD` &&
L=$(git rev-parse --verify HEAD) &&
check_fsck &&
rm -f C A/B/E &&
echo snake >F &&
echo horse >A/G &&
git add F A/G &&
test_tick && git commit -a -m sheep &&
F=`git rev-parse --verify HEAD:F` &&
G=`git rev-parse --verify HEAD:A/G` &&
I=`git rev-parse --verify HEAD:A` &&
J=`git rev-parse --verify HEAD` &&
F=$(git rev-parse --verify HEAD:F) &&
G=$(git rev-parse --verify HEAD:A/G) &&
I=$(git rev-parse --verify HEAD:A) &&
J=$(git rev-parse --verify HEAD) &&
check_fsck &&
rm -f A/G &&
test_tick && git commit -a -m monkey &&
K=`git rev-parse --verify HEAD` &&
K=$(git rev-parse --verify HEAD) &&
check_fsck &&
check_have A B C D E F G H I J K L &&
Expand Down
4 changes: 2 additions & 2 deletions t/t1511-rev-parse-caret.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ test_description='tests for ref^{stuff}'

test_expect_success 'setup' '
echo blob >a-blob &&
git tag -a -m blob blob-tag `git hash-object -w a-blob` &&
git tag -a -m blob blob-tag $(git hash-object -w a-blob) &&
mkdir a-tree &&
echo moreblobs >a-tree/another-blob &&
git add . &&
TREE_SHA1=`git write-tree` &&
TREE_SHA1=$(git write-tree) &&
git tag -a -m tree tree-tag "$TREE_SHA1" &&
git commit -m Initial &&
git tag -a -m commit commit-tag &&
Expand Down
8 changes: 4 additions & 4 deletions t/t1512-rev-parse-disambiguation.sh
Original file line number Diff line number Diff line change
Expand Up @@ -275,19 +275,19 @@ test_expect_success 'rev-parse --disambiguate' '

test_expect_success 'ambiguous 40-hex ref' '
TREE=$(git mktree </dev/null) &&
REF=`git rev-parse HEAD` &&
REF=$(git rev-parse HEAD) &&
VAL=$(git commit-tree $TREE </dev/null) &&
git update-ref refs/heads/$REF $VAL &&
test `git rev-parse $REF 2>err` = $REF &&
test $(git rev-parse $REF 2>err) = $REF &&
grep "refname.*${REF}.*ambiguous" err
'

test_expect_success 'ambiguous short sha1 ref' '
TREE=$(git mktree </dev/null) &&
REF=`git rev-parse --short HEAD` &&
REF=$(git rev-parse --short HEAD) &&
VAL=$(git commit-tree $TREE </dev/null) &&
git update-ref refs/heads/$REF $VAL &&
test `git rev-parse $REF 2>err` = $VAL &&
test $(git rev-parse $REF 2>err) = $VAL &&
grep "refname.*${REF}.*ambiguous" err
'

Expand Down
2 changes: 1 addition & 1 deletion t/t1700-split-index.sh
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ test_expect_success 'disable split index' '
EOF
test_cmp ls-files.expect ls-files.actual &&
BASE=`test-dump-split-index .git/index | grep "^own" | sed "s/own/base/"` &&
BASE=$(test-dump-split-index .git/index | grep "^own" | sed "s/own/base/") &&
test-dump-split-index .git/index | sed "/^own/d" >actual &&
cat >expect <<EOF &&
not a split index
Expand Down
4 changes: 2 additions & 2 deletions t/t2025-worktree-add.sh
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,10 @@ test_expect_success 'checkout from a bare repo without "add"' '
test_expect_success 'checkout with grafts' '
test_when_finished rm .git/info/grafts &&
test_commit abc &&
SHA1=`git rev-parse HEAD` &&
SHA1=$(git rev-parse HEAD) &&
test_commit def &&
test_commit xyz &&
echo "`git rev-parse HEAD` $SHA1" >.git/info/grafts &&
echo "$(git rev-parse HEAD) $SHA1" >.git/info/grafts &&
cat >expected <<-\EOF &&
xyz
abc
Expand Down
2 changes: 1 addition & 1 deletion t/t2102-update-index-symlinks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ git update-index symlink'

test_expect_success \
'the index entry must still be a symbolic link' '
case "`git ls-files --stage --cached symlink`" in
case "$(git ls-files --stage --cached symlink)" in
120000" "*symlink) echo pass;;
*) echo fail; git ls-files --stage --cached symlink; (exit 1);;
esac'
Expand Down
2 changes: 1 addition & 1 deletion t/t3030-merge-recursive.sh
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ test_expect_success 'setup 8' '
test_ln_s_add e a &&
test_tick &&
git commit -m "rename a->e, symlink a->e" &&
oln=`printf e | git hash-object --stdin`
oln=$(printf e | git hash-object --stdin)
'

test_expect_success 'setup 9' '
Expand Down
2 changes: 1 addition & 1 deletion t/t3100-ls-tree-restrict.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ test_expect_success \
echo Mi >path2/baz/b &&
find path? \( -type f -o -type l \) -print |
xargs git update-index --add &&
tree=`git write-tree` &&
tree=$(git write-tree) &&
echo $tree'

test_output () {
Expand Down
2 changes: 1 addition & 1 deletion t/t3101-ls-tree-dirname.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ test_expect_success 'setup' '
echo 222 >path3/2.txt &&
find *.txt path* \( -type f -o -type l \) -print |
xargs git update-index --add &&
tree=`git write-tree` &&
tree=$(git write-tree) &&
echo $tree
'

Expand Down
2 changes: 1 addition & 1 deletion t/t3210-pack-refs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ SHA1=
test_expect_success \
'see if git show-ref works as expected' \
'git branch a &&
SHA1=`cat .git/refs/heads/a` &&
SHA1=$(cat .git/refs/heads/a) &&
echo "$SHA1 refs/heads/a" >expect &&
git show-ref a >result &&
test_cmp expect result'
Expand Down
2 changes: 1 addition & 1 deletion t/t3403-rebase-skip.sh
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ test_expect_success 'rebase --skip with --merge' '
'

test_expect_success 'merge and reference trees equal' '
test -z "`git diff-tree skip-merge skip-reference`"
test -z "$(git diff-tree skip-merge skip-reference)"
'

test_expect_success 'moved back to branch correctly' '
Expand Down
14 changes: 7 additions & 7 deletions t/t3511-cherry-pick-x.sh
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ test_expect_success setup '

test_expect_success 'cherry-pick -x inserts blank line after one line subject' '
pristine_detach initial &&
sha1=`git rev-parse mesg-one-line^0` &&
sha1=$(git rev-parse mesg-one-line^0) &&
git cherry-pick -x mesg-one-line &&
cat <<-EOF >expect &&
$mesg_one_line
Expand Down Expand Up @@ -114,7 +114,7 @@ test_expect_success 'cherry-pick -s inserts blank line after non-conforming foot

test_expect_success 'cherry-pick -x inserts blank line when conforming footer not found' '
pristine_detach initial &&
sha1=`git rev-parse mesg-no-footer^0` &&
sha1=$(git rev-parse mesg-no-footer^0) &&
git cherry-pick -x mesg-no-footer &&
cat <<-EOF >expect &&
$mesg_no_footer
Expand All @@ -139,7 +139,7 @@ test_expect_success 'cherry-pick -s inserts blank line when conforming footer no

test_expect_success 'cherry-pick -x -s inserts blank line when conforming footer not found' '
pristine_detach initial &&
sha1=`git rev-parse mesg-no-footer^0` &&
sha1=$(git rev-parse mesg-no-footer^0) &&
git cherry-pick -x -s mesg-no-footer &&
cat <<-EOF >expect &&
$mesg_no_footer
Expand All @@ -164,7 +164,7 @@ test_expect_success 'cherry-pick -s adds sob when last sob doesnt match committe

test_expect_success 'cherry-pick -x -s adds sob when last sob doesnt match committer' '
pristine_detach initial &&
sha1=`git rev-parse mesg-with-footer^0` &&
sha1=$(git rev-parse mesg-with-footer^0) &&
git cherry-pick -x -s mesg-with-footer &&
cat <<-EOF >expect &&
$mesg_with_footer
Expand All @@ -187,7 +187,7 @@ test_expect_success 'cherry-pick -s refrains from adding duplicate trailing sob'

test_expect_success 'cherry-pick -x -s adds sob even when trailing sob exists for committer' '
pristine_detach initial &&
sha1=`git rev-parse mesg-with-footer-sob^0` &&
sha1=$(git rev-parse mesg-with-footer-sob^0) &&
git cherry-pick -x -s mesg-with-footer-sob &&
cat <<-EOF >expect &&
$mesg_with_footer_sob
Expand All @@ -200,7 +200,7 @@ test_expect_success 'cherry-pick -x -s adds sob even when trailing sob exists fo

test_expect_success 'cherry-pick -x treats "(cherry picked from..." line as part of footer' '
pristine_detach initial &&
sha1=`git rev-parse mesg-with-cherry-footer^0` &&
sha1=$(git rev-parse mesg-with-cherry-footer^0) &&
git cherry-pick -x mesg-with-cherry-footer &&
cat <<-EOF >expect &&
$mesg_with_cherry_footer
Expand All @@ -223,7 +223,7 @@ test_expect_success 'cherry-pick -s treats "(cherry picked from..." line as part

test_expect_success 'cherry-pick -x -s treats "(cherry picked from..." line as part of footer' '
pristine_detach initial &&
sha1=`git rev-parse mesg-with-cherry-footer^0` &&
sha1=$(git rev-parse mesg-with-cherry-footer^0) &&
git cherry-pick -x -s mesg-with-cherry-footer &&
cat <<-EOF >expect &&
$mesg_with_cherry_footer
Expand Down
4 changes: 2 additions & 2 deletions t/t3600-rm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ test_expect_success '"rm" command printed' '
git add test-file &&
git commit -m "add file for rm test" &&
git rm test-file > rm-output &&
test `grep "^rm " rm-output | wc -l` = 1 &&
test $(grep "^rm " rm-output | wc -l) = 1 &&
rm -f test-file rm-output &&
git commit -m "remove file from rm test"
'
Expand All @@ -125,7 +125,7 @@ test_expect_success '"rm" command suppressed with --quiet' '
git add test-file &&
git commit -m "add file for rm --quiet test" &&
git rm --quiet test-file > rm-output &&
test `wc -l < rm-output` = 0 &&
test $(wc -l < rm-output) = 0 &&
rm -f test-file rm-output &&
git commit -m "remove file from rm --quiet test"
'
Expand Down
Loading

0 comments on commit e572fef

Please sign in to comment.