* [PATCH 00/10] use the $( ... ) construct for command substitution
@ 2016-01-12 10:45 Elia Pinto
2016-01-12 10:45 ` [PATCH 01/10] t9100-git-svn-basic.sh: " Elia Pinto
` (9 more replies)
0 siblings, 10 replies; 12+ messages in thread
From: Elia Pinto @ 2016-01-12 10:45 UTC (permalink / raw)
To: git; +Cc: Elia Pinto
This patch series continues the changes introduced with the merge
6753d8a85d543253d95184ec2faad6dc197f248:
Merge branch 'ep/shell-command-substitution'
Adjust shell scripts to use $(cmd) instead of `cmd`.
This is the eighth series, the other will be sent separately.
Elia Pinto (10):
t9100-git-svn-basic.sh: use the $( ... ) construct for command
substitution
t9101-git-svn-props.sh: use the $( ... ) construct for command
substitution
t9104-git-svn-follow-parent.sh: use the $( ... ) construct for command
substitution
t9105-git-svn-commit-diff.sh: use the $( ... ) construct for command
substitution
t9107-git-svn-migrate.sh: use the $( ... ) construct for command
substitution
t9108-git-svn-glob.sh: use the $( ... ) construct for command
substitution
t9109-git-svn-multi-glob.sh: use the $( ... ) construct for command
substitution
t9110-git-svn-use-svm-props.sh: use the $( ... ) construct for command
substitution
t9114-git-svn-dcommit-merge.sh: use the $( ... ) construct for command
substitution
t9118-git-svn-funky-branch-names.sh: use the $( ... ) construct for
command substitution
t/t9100-git-svn-basic.sh | 8 ++---
t/t9101-git-svn-props.sh | 30 ++++++++--------
t/t9104-git-svn-follow-parent.sh | 68 +++++++++++++++++------------------
t/t9105-git-svn-commit-diff.sh | 4 +--
t/t9107-git-svn-migrate.sh | 28 +++++++--------
t/t9108-git-svn-glob.sh | 20 +++++------
t/t9109-git-svn-multi-glob.sh | 32 ++++++++---------
t/t9110-git-svn-use-svm-props.sh | 2 +-
t/t9114-git-svn-dcommit-merge.sh | 12 +++----
t/t9118-git-svn-funky-branch-names.sh | 2 +-
10 files changed, 103 insertions(+), 103 deletions(-)
--
2.5.0
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH 01/10] t9100-git-svn-basic.sh: use the $( ... ) construct for command substitution
2016-01-12 10:45 [PATCH 00/10] use the $( ... ) construct for command substitution Elia Pinto
@ 2016-01-12 10:45 ` Elia Pinto
2016-01-12 19:56 ` Junio C Hamano
2016-01-12 10:45 ` [PATCH 02/10] t9101-git-svn-props.sh: " Elia Pinto
` (8 subsequent siblings)
9 siblings, 1 reply; 12+ messages in thread
From: Elia Pinto @ 2016-01-12 10:45 UTC (permalink / raw)
To: git; +Cc: Elia Pinto
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>
---
t/t9100-git-svn-basic.sh | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/t/t9100-git-svn-basic.sh b/t/t9100-git-svn-basic.sh
index 4fea8d9..258d9b8 100755
--- a/t/t9100-git-svn-basic.sh
+++ b/t/t9100-git-svn-basic.sh
@@ -265,18 +265,18 @@ test_expect_success 'able to dcommit to a subdirectory' "
git update-index --add d &&
git commit -m '/bar/d should be in the log' &&
git svn dcommit -i bar &&
- test -z \"\`git diff refs/heads/my-bar refs/remotes/bar\`\" &&
+ test -z \"\$(git diff refs/heads/my-bar refs/remotes/bar)\" &&
mkdir newdir &&
echo new > newdir/dir &&
git update-index --add newdir/dir &&
git commit -m 'add a new directory' &&
git svn dcommit -i bar &&
- test -z \"\`git diff refs/heads/my-bar refs/remotes/bar\`\" &&
+ test -z \"\$(git diff refs/heads/my-bar refs/remotes/bar)\" &&
echo foo >> newdir/dir &&
git update-index newdir/dir &&
git commit -m 'modify a file in new directory' &&
git svn dcommit -i bar &&
- test -z \"\`git diff refs/heads/my-bar refs/remotes/bar\`\"
+ test -z \"\$(git diff refs/heads/my-bar refs/remotes/bar)\"
"
test_expect_success 'dcommit should not fail with a touched file' '
@@ -295,7 +295,7 @@ test_expect_success 'able to set-tree to a subdirectory' "
git update-index d &&
git commit -m 'update /bar/d' &&
git svn set-tree -i bar HEAD &&
- test -z \"\`git diff refs/heads/my-bar refs/remotes/bar\`\"
+ test -z \"\$(git diff refs/heads/my-bar refs/remotes/bar)\"
"
test_expect_success 'git-svn works in a bare repository' '
--
2.5.0
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 02/10] t9101-git-svn-props.sh: use the $( ... ) construct for command substitution
2016-01-12 10:45 [PATCH 00/10] use the $( ... ) construct for command substitution Elia Pinto
2016-01-12 10:45 ` [PATCH 01/10] t9100-git-svn-basic.sh: " Elia Pinto
@ 2016-01-12 10:45 ` Elia Pinto
2016-01-12 10:45 ` [PATCH 03/10] t9104-git-svn-follow-parent.sh: " Elia Pinto
` (7 subsequent siblings)
9 siblings, 0 replies; 12+ messages in thread
From: Elia Pinto @ 2016-01-12 10:45 UTC (permalink / raw)
To: git; +Cc: Elia Pinto
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>
---
t/t9101-git-svn-props.sh | 30 +++++++++++++++---------------
1 file changed, 15 insertions(+), 15 deletions(-)
diff --git a/t/t9101-git-svn-props.sh b/t/t9101-git-svn-props.sh
index 8869f50..e8173d5 100755
--- a/t/t9101-git-svn-props.sh
+++ b/t/t9101-git-svn-props.sh
@@ -26,27 +26,27 @@ cd import
EOF
printf "Hello\r\nWorld\r\n" > crlf
- a_crlf=`git hash-object -w crlf`
+ a_crlf=$(git hash-object -w crlf)
printf "Hello\rWorld\r" > cr
- a_cr=`git hash-object -w cr`
+ a_cr=$(git hash-object -w cr)
printf "Hello\nWorld\n" > lf
- a_lf=`git hash-object -w lf`
+ a_lf=$(git hash-object -w lf)
printf "Hello\r\nWorld" > ne_crlf
- a_ne_crlf=`git hash-object -w ne_crlf`
+ a_ne_crlf=$(git hash-object -w ne_crlf)
printf "Hello\nWorld" > ne_lf
- a_ne_lf=`git hash-object -w ne_lf`
+ a_ne_lf=$(git hash-object -w ne_lf)
printf "Hello\rWorld" > ne_cr
- a_ne_cr=`git hash-object -w ne_cr`
+ a_ne_cr=$(git hash-object -w ne_cr)
touch empty
- a_empty=`git hash-object -w empty`
+ a_empty=$(git hash-object -w empty)
printf "\n" > empty_lf
- a_empty_lf=`git hash-object -w empty_lf`
+ a_empty_lf=$(git hash-object -w empty_lf)
printf "\r" > empty_cr
- a_empty_cr=`git hash-object -w empty_cr`
+ a_empty_cr=$(git hash-object -w empty_cr)
printf "\r\n" > empty_crlf
- a_empty_crlf=`git hash-object -w empty_crlf`
+ a_empty_crlf=$(git hash-object -w empty_crlf)
svn_cmd import --no-auto-props -m 'import for git svn' . "$svnrepo" >/dev/null
cd ..
@@ -80,7 +80,7 @@ test_expect_success "$name" \
git pull . ${remotes_git_svn}'
expect='/* $Id$ */'
-got="`sed -ne 2p kw.c`"
+got="$(sed -ne 2p kw.c)"
test_expect_success 'raw $Id$ found in kw.c' "test '$expect' = '$got'"
test_expect_success "propset CR on crlf files" '
@@ -107,8 +107,8 @@ done
cd test_wc
printf '$Id$\rHello\rWorld\r' > cr
printf '$Id$\rHello\rWorld' > ne_cr
- a_cr=`printf '$Id$\r\nHello\r\nWorld\r\n' | git hash-object --stdin`
- a_ne_cr=`printf '$Id$\r\nHello\r\nWorld' | git hash-object --stdin`
+ a_cr=$(printf '$Id$\r\nHello\r\nWorld\r\n' | git hash-object --stdin)
+ a_ne_cr=$(printf '$Id$\r\nHello\r\nWorld' | git hash-object --stdin)
test_expect_success 'Set CRLF on cr files' \
'svn_cmd propset svn:eol-style CRLF cr &&
svn_cmd propset svn:eol-style CRLF ne_cr &&
@@ -119,8 +119,8 @@ cd ..
test_expect_success 'fetch and pull latest from svn' \
'git svn fetch && git pull . ${remotes_git_svn}'
-b_cr="`git hash-object cr`"
-b_ne_cr="`git hash-object ne_cr`"
+b_cr="$(git hash-object cr)"
+b_ne_cr="$(git hash-object ne_cr)"
test_expect_success 'CRLF + $Id$' "test '$a_cr' = '$b_cr'"
test_expect_success 'CRLF + $Id$ (no newline)' "test '$a_ne_cr' = '$b_ne_cr'"
--
2.5.0
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 03/10] t9104-git-svn-follow-parent.sh: use the $( ... ) construct for command substitution
2016-01-12 10:45 [PATCH 00/10] use the $( ... ) construct for command substitution Elia Pinto
2016-01-12 10:45 ` [PATCH 01/10] t9100-git-svn-basic.sh: " Elia Pinto
2016-01-12 10:45 ` [PATCH 02/10] t9101-git-svn-props.sh: " Elia Pinto
@ 2016-01-12 10:45 ` Elia Pinto
2016-01-12 10:45 ` [PATCH 04/10] t9105-git-svn-commit-diff.sh: " Elia Pinto
` (6 subsequent siblings)
9 siblings, 0 replies; 12+ messages in thread
From: Elia Pinto @ 2016-01-12 10:45 UTC (permalink / raw)
To: git; +Cc: Elia Pinto
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>
---
t/t9104-git-svn-follow-parent.sh | 68 ++++++++++++++++++++--------------------
1 file changed, 34 insertions(+), 34 deletions(-)
diff --git a/t/t9104-git-svn-follow-parent.sh b/t/t9104-git-svn-follow-parent.sh
index 83f17e1..872aa79 100755
--- a/t/t9104-git-svn-follow-parent.sh
+++ b/t/t9104-git-svn-follow-parent.sh
@@ -31,12 +31,12 @@ test_expect_success 'initialize repo' '
test_expect_success 'init and fetch a moved directory' '
git svn init --minimize-url -i thunk "$svnrepo"/thunk &&
git svn fetch -i thunk &&
- test "`git rev-parse --verify refs/remotes/thunk@2`" \
- = "`git rev-parse --verify refs/remotes/thunk~1`" &&
- test "`git cat-file blob refs/remotes/thunk:readme |\
- sed -n -e "3p"`" = goodbye &&
- test -z "`git config --get svn-remote.svn.fetch \
- "^trunk:refs/remotes/thunk@2$"`"
+ test "$(git rev-parse --verify refs/remotes/thunk@2)" \
+ = "$(git rev-parse --verify refs/remotes/thunk~1)" &&
+ test "$(git cat-file blob refs/remotes/thunk:readme |\
+ sed -n -e "3p")" = goodbye &&
+ test -z "$(git config --get svn-remote.svn.fetch \
+ "^trunk:refs/remotes/thunk@2$")"
'
test_expect_success 'init and fetch from one svn-remote' '
@@ -46,10 +46,10 @@ test_expect_success 'init and fetch from one svn-remote' '
git config --add svn-remote.svn.fetch \
thunk:refs/remotes/svn/thunk &&
git svn fetch -i svn/thunk &&
- test "`git rev-parse --verify refs/remotes/svn/trunk`" \
- = "`git rev-parse --verify refs/remotes/svn/thunk~1`" &&
- test "`git cat-file blob refs/remotes/svn/thunk:readme |\
- sed -n -e "3p"`" = goodbye
+ test "$(git rev-parse --verify refs/remotes/svn/trunk)" \
+ = "$(git rev-parse --verify refs/remotes/svn/thunk~1)" &&
+ test "$(git cat-file blob refs/remotes/svn/thunk:readme |\
+ sed -n -e "3p")" = goodbye
'
test_expect_success 'follow deleted parent' '
@@ -61,9 +61,9 @@ test_expect_success 'follow deleted parent' '
junk:refs/remotes/svn/junk &&
git svn fetch -i svn/thunk &&
git svn fetch -i svn/junk &&
- test -z "`git diff svn/junk svn/trunk`" &&
- test "`git merge-base svn/junk svn/trunk`" \
- = "`git rev-parse svn/trunk`"
+ test -z "$(git diff svn/junk svn/trunk)" &&
+ test "$(git merge-base svn/junk svn/trunk)" \
+ = "$(git rev-parse svn/trunk)"
'
test_expect_success 'follow larger parent' '
@@ -80,10 +80,10 @@ test_expect_success 'follow larger parent' '
git rev-parse --verify refs/remotes/larger &&
git rev-parse --verify \
refs/remotes/larger-parent &&
- test "`git merge-base \
+ test "$(git merge-base \
refs/remotes/larger-parent \
- refs/remotes/larger`" = \
- "`git rev-parse refs/remotes/larger`"
+ refs/remotes/larger)" = \
+ "$(git rev-parse refs/remotes/larger)"
'
test_expect_success 'follow higher-level parent' '
@@ -106,8 +106,8 @@ test_expect_success 'follow deleted directory' '
svn_cmd rm -m "remove glob" "$svnrepo"/glob &&
git svn init --minimize-url -i glob "$svnrepo"/glob &&
git svn fetch -i glob &&
- test "`git cat-file blob refs/remotes/glob:blob/bye`" = hi &&
- test "`git ls-tree refs/remotes/glob | wc -l `" -eq 1
+ test "$(git cat-file blob refs/remotes/glob:blob/bye)" = hi &&
+ test "$(git ls-tree refs/remotes/glob | wc -l )" -eq 1
'
# ref: r9270 of the Subversion repository: (http://svn.collab.net/repos/svn)
@@ -142,9 +142,9 @@ test_expect_success 'follow-parent avoids deleting relevant info' '
git svn init --minimize-url -i r9270-t \
"$svnrepo"/r9270/trunk/subversion/bindings/swig/perl/native/t &&
git svn fetch -i r9270-t &&
- test `git rev-list r9270-t | wc -l` -eq 2 &&
- test "`git ls-tree --name-only r9270-t~1`" = \
- "`git ls-tree --name-only r9270-t`"
+ test $(git rev-list r9270-t | wc -l) -eq 2 &&
+ test "$(git ls-tree --name-only r9270-t~1)" = \
+ "$(git ls-tree --name-only r9270-t)"
'
test_expect_success "track initial change if it was only made to parent" '
@@ -152,11 +152,11 @@ test_expect_success "track initial change if it was only made to parent" '
git svn init --minimize-url -i r9270-d \
"$svnrepo"/r9270/drunk/subversion/bindings/swig/perl/native/t &&
git svn fetch -i r9270-d &&
- test `git rev-list r9270-d | wc -l` -eq 3 &&
- test "`git ls-tree --name-only r9270-t`" = \
- "`git ls-tree --name-only r9270-d`" &&
- test "`git rev-parse r9270-t`" = \
- "`git rev-parse r9270-d~1`"
+ test $(git rev-list r9270-d | wc -l) -eq 3 &&
+ test "$(git ls-tree --name-only r9270-t)" = \
+ "$(git ls-tree --name-only r9270-d)" &&
+ test "$(git rev-parse r9270-t)" = \
+ "$(git rev-parse r9270-d~1)"
'
test_expect_success "follow-parent is atomic" '
@@ -193,19 +193,19 @@ test_expect_success "follow-parent is atomic" '
git svn fetch -i stunk &&
git svn init --minimize-url -i flunked "$svnrepo"/flunked &&
git svn fetch -i flunked &&
- test "`git rev-parse --verify refs/remotes/flunk@18`" \
- = "`git rev-parse --verify refs/remotes/stunk`" &&
- test "`git rev-parse --verify refs/remotes/flunk~1`" \
- = "`git rev-parse --verify refs/remotes/stunk`" &&
- test "`git rev-parse --verify refs/remotes/flunked~1`" \
- = "`git rev-parse --verify refs/remotes/stunk~1`"
+ test "$(git rev-parse --verify refs/remotes/flunk@18)" \
+ = "$(git rev-parse --verify refs/remotes/stunk)" &&
+ test "$(git rev-parse --verify refs/remotes/flunk~1)" \
+ = "$(git rev-parse --verify refs/remotes/stunk)" &&
+ test "$(git rev-parse --verify refs/remotes/flunked~1)" \
+ = "$(git rev-parse --verify refs/remotes/stunk~1)"
'
test_expect_success "track multi-parent paths" '
svn_cmd cp -m "resurrect /glob" "$svnrepo"/r9270 "$svnrepo"/glob &&
git svn multi-fetch &&
- test `git cat-file commit refs/remotes/glob | \
- grep "^parent " | wc -l` -eq 2
+ test $(git cat-file commit refs/remotes/glob | \
+ grep "^parent " | wc -l) -eq 2
'
test_expect_success "multi-fetch continues to work" "
--
2.5.0
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 04/10] t9105-git-svn-commit-diff.sh: use the $( ... ) construct for command substitution
2016-01-12 10:45 [PATCH 00/10] use the $( ... ) construct for command substitution Elia Pinto
` (2 preceding siblings ...)
2016-01-12 10:45 ` [PATCH 03/10] t9104-git-svn-follow-parent.sh: " Elia Pinto
@ 2016-01-12 10:45 ` Elia Pinto
2016-01-12 10:45 ` [PATCH 05/10] t9107-git-svn-migrate.sh: " Elia Pinto
` (5 subsequent siblings)
9 siblings, 0 replies; 12+ messages in thread
From: Elia Pinto @ 2016-01-12 10:45 UTC (permalink / raw)
To: git; +Cc: Elia Pinto
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>
---
t/t9105-git-svn-commit-diff.sh | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/t/t9105-git-svn-commit-diff.sh b/t/t9105-git-svn-commit-diff.sh
index 5d0afea..6ed5f74 100755
--- a/t/t9105-git-svn-commit-diff.sh
+++ b/t/t9105-git-svn-commit-diff.sh
@@ -18,8 +18,8 @@ test_expect_success 'initialize repo' '
git commit -a -m "another"
'
-head=`git rev-parse --verify HEAD^0`
-prev=`git rev-parse --verify HEAD^1`
+head=$(git rev-parse --verify HEAD^0)
+prev=$(git rev-parse --verify HEAD^1)
# the internals of the commit-diff command are the same as the regular
# commit, so only a basic test of functionality is needed since we've
--
2.5.0
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 05/10] t9107-git-svn-migrate.sh: use the $( ... ) construct for command substitution
2016-01-12 10:45 [PATCH 00/10] use the $( ... ) construct for command substitution Elia Pinto
` (3 preceding siblings ...)
2016-01-12 10:45 ` [PATCH 04/10] t9105-git-svn-commit-diff.sh: " Elia Pinto
@ 2016-01-12 10:45 ` Elia Pinto
2016-01-12 10:45 ` [PATCH 06/10] t9108-git-svn-glob.sh: " Elia Pinto
` (4 subsequent siblings)
9 siblings, 0 replies; 12+ messages in thread
From: Elia Pinto @ 2016-01-12 10:45 UTC (permalink / raw)
To: git; +Cc: Elia Pinto
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>
---
t/t9107-git-svn-migrate.sh | 28 ++++++++++++++--------------
1 file changed, 14 insertions(+), 14 deletions(-)
diff --git a/t/t9107-git-svn-migrate.sh b/t/t9107-git-svn-migrate.sh
index 6e69fc4..155b8bf 100755
--- a/t/t9107-git-svn-migrate.sh
+++ b/t/t9107-git-svn-migrate.sh
@@ -24,10 +24,10 @@ test_expect_success 'setup old-looking metadata' '
git update-ref -d refs/${remotes_git_svn} refs/${remotes_git_svn}
'
-head=`git rev-parse --verify refs/heads/git-svn-HEAD^0`
+head=$(git rev-parse --verify refs/heads/git-svn-HEAD^0)
test_expect_success 'git-svn-HEAD is a real HEAD' "test -n '$head'"
-svnrepo_escaped=`echo $svnrepo | sed 's/ /%20/'`
+svnrepo_escaped=$(echo $svnrepo | sed 's/ /%20/')
test_expect_success 'initialize old-style (v0) git svn layout' '
mkdir -p "$GIT_DIR"/git-svn/info "$GIT_DIR"/svn/info &&
@@ -38,7 +38,7 @@ test_expect_success 'initialize old-style (v0) git svn layout' '
git rev-parse --verify refs/${remotes_git_svn}^0 &&
git rev-parse --verify refs/remotes/svn^0 &&
test "$(git config --get svn-remote.svn.url)" = "$svnrepo_escaped" &&
- test `git config --get svn-remote.svn.fetch` = \
+ test $(git config --get svn-remote.svn.fetch) = \
":refs/${remotes_git_svn}"
'
@@ -46,10 +46,10 @@ test_expect_success 'initialize a multi-repository repo' '
git svn init "$svnrepo" -T trunk -t tags -b branches &&
git config --get-all svn-remote.svn.fetch > fetch.out &&
grep "^trunk:refs/remotes/origin/trunk$" fetch.out &&
- test -n "`git config --get svn-remote.svn.branches \
- "^branches/\*:refs/remotes/origin/\*$"`" &&
- test -n "`git config --get svn-remote.svn.tags \
- "^tags/\*:refs/remotes/origin/tags/\*$"`" &&
+ test -n "$(git config --get svn-remote.svn.branches \
+ "^branches/\*:refs/remotes/origin/\*$")" &&
+ test -n "$(git config --get svn-remote.svn.tags \
+ "^tags/\*:refs/remotes/origin/tags/\*$")" &&
git config --unset svn-remote.svn.branches \
"^branches/\*:refs/remotes/origin/\*$" &&
git config --unset svn-remote.svn.tags \
@@ -75,28 +75,28 @@ test_expect_success 'multi-fetch works on partial urls + paths' "
for i in trunk a b tags/0.1 tags/0.2 tags/0.3; do
git rev-parse --verify refs/remotes/origin/\$i^0 >> refs.out || exit 1;
done &&
- test -z \"\`sort < refs.out | uniq -d\`\" &&
+ test -z \"\$(sort < refs.out | uniq -d)\" &&
for i in trunk a b tags/0.1 tags/0.2 tags/0.3; do
for j in trunk a b tags/0.1 tags/0.2 tags/0.3; do
if test \$j != \$i; then continue; fi
- test -z \"\`git diff refs/remotes/origin/\$i \
- refs/remotes/origin/\$j\`\" ||exit 1; done; done
+ test -z \"\$(git diff refs/remotes/origin/\$i \
+ refs/remotes/origin/\$j)\" ||exit 1; done; done
"
test_expect_success 'migrate --minimize on old inited layout' '
git config --unset-all svn-remote.svn.fetch &&
git config --unset-all svn-remote.svn.url &&
rm -rf "$GIT_DIR"/svn &&
- for i in `cat fetch.out`; do
- path=`expr $i : "\([^:]*\):.*$"`
- ref=`expr $i : "[^:]*:\(refs/remotes/.*\)$"`
+ for i in $(cat fetch.out); do
+ path=$(expr $i : "\([^:]*\):.*$")
+ ref=$(expr $i : "[^:]*:\(refs/remotes/.*\)$")
if test -z "$ref"; then continue; fi
if test -n "$path"; then path="/$path"; fi
( mkdir -p "$GIT_DIR"/svn/$ref/info/ &&
echo "$svnrepo"$path > "$GIT_DIR"/svn/$ref/info/url ) || exit 1;
done &&
git svn migrate --minimize &&
- test -z "`git config -l | grep "^svn-remote\.git-svn\."`" &&
+ test -z "$(git config -l | grep "^svn-remote\.git-svn\.")" &&
git config --get-all svn-remote.svn.fetch > fetch.out &&
grep "^trunk:refs/remotes/origin/trunk$" fetch.out &&
grep "^branches/a:refs/remotes/origin/a$" fetch.out &&
--
2.5.0
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 06/10] t9108-git-svn-glob.sh: use the $( ... ) construct for command substitution
2016-01-12 10:45 [PATCH 00/10] use the $( ... ) construct for command substitution Elia Pinto
` (4 preceding siblings ...)
2016-01-12 10:45 ` [PATCH 05/10] t9107-git-svn-migrate.sh: " Elia Pinto
@ 2016-01-12 10:45 ` Elia Pinto
2016-01-12 10:45 ` [PATCH 07/10] t9109-git-svn-multi-glob.sh: " Elia Pinto
` (3 subsequent siblings)
9 siblings, 0 replies; 12+ messages in thread
From: Elia Pinto @ 2016-01-12 10:45 UTC (permalink / raw)
To: git; +Cc: Elia Pinto
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>
---
t/t9108-git-svn-glob.sh | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/t/t9108-git-svn-glob.sh b/t/t9108-git-svn-glob.sh
index d732d31..a526d60 100755
--- a/t/t9108-git-svn-glob.sh
+++ b/t/t9108-git-svn-glob.sh
@@ -50,10 +50,10 @@ test_expect_success 'test refspec globbing' '
git log --pretty=oneline refs/remotes/tags/end | \
sed -e "s/^.\{41\}//" > output.end &&
test_cmp expect.end output.end &&
- test "`git rev-parse refs/remotes/tags/end~1`" = \
- "`git rev-parse refs/remotes/branches/start`" &&
- test "`git rev-parse refs/remotes/branches/start~2`" = \
- "`git rev-parse refs/remotes/trunk`" &&
+ test "$(git rev-parse refs/remotes/tags/end~1)" = \
+ "$(git rev-parse refs/remotes/branches/start)" &&
+ test "$(git rev-parse refs/remotes/branches/start~2)" = \
+ "$(git rev-parse refs/remotes/trunk)" &&
test_must_fail git rev-parse refs/remotes/tags/end@3
'
@@ -75,12 +75,12 @@ test_expect_success 'test left-hand-side only globbing' '
svn_cmd commit -m "try to try"
) &&
git svn fetch two &&
- test `git rev-list refs/remotes/two/tags/end | wc -l` -eq 6 &&
- test `git rev-list refs/remotes/two/branches/start | wc -l` -eq 3 &&
- test `git rev-parse refs/remotes/two/branches/start~2` = \
- `git rev-parse refs/remotes/two/trunk` &&
- test `git rev-parse refs/remotes/two/tags/end~3` = \
- `git rev-parse refs/remotes/two/branches/start` &&
+ test $(git rev-list refs/remotes/two/tags/end | wc -l) -eq 6 &&
+ test $(git rev-list refs/remotes/two/branches/start | wc -l) -eq 3 &&
+ test $(git rev-parse refs/remotes/two/branches/start~2) = \
+ $(git rev-parse refs/remotes/two/trunk) &&
+ test $(git rev-parse refs/remotes/two/tags/end~3) = \
+ $(git rev-parse refs/remotes/two/branches/start) &&
git log --pretty=oneline refs/remotes/two/tags/end | \
sed -e "s/^.\{41\}//" > output.two &&
test_cmp expect.two output.two
--
2.5.0
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 07/10] t9109-git-svn-multi-glob.sh: use the $( ... ) construct for command substitution
2016-01-12 10:45 [PATCH 00/10] use the $( ... ) construct for command substitution Elia Pinto
` (5 preceding siblings ...)
2016-01-12 10:45 ` [PATCH 06/10] t9108-git-svn-glob.sh: " Elia Pinto
@ 2016-01-12 10:45 ` Elia Pinto
2016-01-12 10:45 ` [PATCH 08/10] t9110-git-svn-use-svm-props.sh: " Elia Pinto
` (2 subsequent siblings)
9 siblings, 0 replies; 12+ messages in thread
From: Elia Pinto @ 2016-01-12 10:45 UTC (permalink / raw)
To: git; +Cc: Elia Pinto
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>
---
t/t9109-git-svn-multi-glob.sh | 32 ++++++++++++++++----------------
1 file changed, 16 insertions(+), 16 deletions(-)
diff --git a/t/t9109-git-svn-multi-glob.sh b/t/t9109-git-svn-multi-glob.sh
index c318f9f..f36b749 100755
--- a/t/t9109-git-svn-multi-glob.sh
+++ b/t/t9109-git-svn-multi-glob.sh
@@ -50,10 +50,10 @@ test_expect_success 'test refspec globbing' '
git log --pretty=oneline refs/remotes/tags/end | \
sed -e "s/^.\{41\}//" > output.end &&
test_cmp expect.end output.end &&
- test "`git rev-parse refs/remotes/tags/end~1`" = \
- "`git rev-parse refs/remotes/branches/v1/start`" &&
- test "`git rev-parse refs/remotes/branches/v1/start~2`" = \
- "`git rev-parse refs/remotes/trunk`" &&
+ test "$(git rev-parse refs/remotes/tags/end~1)" = \
+ "$(git rev-parse refs/remotes/branches/v1/start)" &&
+ test "$(git rev-parse refs/remotes/branches/v1/start~2)" = \
+ "$(git rev-parse refs/remotes/trunk)" &&
test_must_fail git rev-parse refs/remotes/tags/end@3
'
@@ -75,12 +75,12 @@ test_expect_success 'test left-hand-side only globbing' '
svn_cmd commit -m "try to try"
) &&
git svn fetch two &&
- test `git rev-list refs/remotes/two/tags/end | wc -l` -eq 6 &&
- test `git rev-list refs/remotes/two/branches/v1/start | wc -l` -eq 3 &&
- test `git rev-parse refs/remotes/two/branches/v1/start~2` = \
- `git rev-parse refs/remotes/two/trunk` &&
- test `git rev-parse refs/remotes/two/tags/end~3` = \
- `git rev-parse refs/remotes/two/branches/v1/start` &&
+ test $(git rev-list refs/remotes/two/tags/end | wc -l) -eq 6 &&
+ test $(git rev-list refs/remotes/two/branches/v1/start | wc -l) -eq 3 &&
+ test $(git rev-parse refs/remotes/two/branches/v1/start~2) = \
+ $(git rev-parse refs/remotes/two/trunk) &&
+ test $(git rev-parse refs/remotes/two/tags/end~3) = \
+ $(git rev-parse refs/remotes/two/branches/v1/start) &&
git log --pretty=oneline refs/remotes/two/tags/end | \
sed -e "s/^.\{41\}//" > output.two &&
test_cmp expect.two output.two
@@ -124,12 +124,12 @@ test_expect_success 'test another branch' '
git config --add svn-remote.four.tags \
"tags/*:refs/remotes/four/tags/*" &&
git svn fetch four &&
- test `git rev-list refs/remotes/four/tags/next | wc -l` -eq 5 &&
- test `git rev-list refs/remotes/four/branches/v2/start | wc -l` -eq 3 &&
- test `git rev-parse refs/remotes/four/branches/v2/start~2` = \
- `git rev-parse refs/remotes/four/trunk` &&
- test `git rev-parse refs/remotes/four/tags/next~2` = \
- `git rev-parse refs/remotes/four/branches/v2/start` &&
+ test $(git rev-list refs/remotes/four/tags/next | wc -l) -eq 5 &&
+ test $(git rev-list refs/remotes/four/branches/v2/start | wc -l) -eq 3 &&
+ test $(git rev-parse refs/remotes/four/branches/v2/start~2) = \
+ $(git rev-parse refs/remotes/four/trunk) &&
+ test $(git rev-parse refs/remotes/four/tags/next~2) = \
+ $(git rev-parse refs/remotes/four/branches/v2/start) &&
git log --pretty=oneline refs/remotes/four/tags/next | \
sed -e "s/^.\{41\}//" > output.four &&
test_cmp expect.four output.four
--
2.5.0
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 08/10] t9110-git-svn-use-svm-props.sh: use the $( ... ) construct for command substitution
2016-01-12 10:45 [PATCH 00/10] use the $( ... ) construct for command substitution Elia Pinto
` (6 preceding siblings ...)
2016-01-12 10:45 ` [PATCH 07/10] t9109-git-svn-multi-glob.sh: " Elia Pinto
@ 2016-01-12 10:45 ` Elia Pinto
2016-01-12 10:45 ` [PATCH 09/10] t9114-git-svn-dcommit-merge.sh: " Elia Pinto
2016-01-12 10:45 ` [PATCH 10/10] t9118-git-svn-funky-branch-names.sh: " Elia Pinto
9 siblings, 0 replies; 12+ messages in thread
From: Elia Pinto @ 2016-01-12 10:45 UTC (permalink / raw)
To: git; +Cc: Elia Pinto
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>
---
t/t9110-git-svn-use-svm-props.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/t/t9110-git-svn-use-svm-props.sh b/t/t9110-git-svn-use-svm-props.sh
index a06e4c5..29fbdfd 100755
--- a/t/t9110-git-svn-use-svm-props.sh
+++ b/t/t9110-git-svn-use-svm-props.sh
@@ -51,7 +51,7 @@ test_expect_success 'verify metadata for /dir' "
test_expect_success 'find commit based on SVN revision number' "
git svn find-rev r12 |
- grep `git rev-parse HEAD`
+ grep $(git rev-parse HEAD)
"
test_expect_success 'empty rebase' "
--
2.5.0
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 09/10] t9114-git-svn-dcommit-merge.sh: use the $( ... ) construct for command substitution
2016-01-12 10:45 [PATCH 00/10] use the $( ... ) construct for command substitution Elia Pinto
` (7 preceding siblings ...)
2016-01-12 10:45 ` [PATCH 08/10] t9110-git-svn-use-svm-props.sh: " Elia Pinto
@ 2016-01-12 10:45 ` Elia Pinto
2016-01-12 10:45 ` [PATCH 10/10] t9118-git-svn-funky-branch-names.sh: " Elia Pinto
9 siblings, 0 replies; 12+ messages in thread
From: Elia Pinto @ 2016-01-12 10:45 UTC (permalink / raw)
To: git; +Cc: Elia Pinto
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>
---
t/t9114-git-svn-dcommit-merge.sh | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/t/t9114-git-svn-dcommit-merge.sh b/t/t9114-git-svn-dcommit-merge.sh
index fb41876..a3d3882 100755
--- a/t/t9114-git-svn-dcommit-merge.sh
+++ b/t/t9114-git-svn-dcommit-merge.sh
@@ -68,8 +68,8 @@ test_expect_success 'setup git mirror and merge' '
test_debug 'gitk --all & sleep 1'
test_expect_success 'verify pre-merge ancestry' "
- test x\`git rev-parse --verify refs/heads/svn^2\` = \
- x\`git rev-parse --verify refs/heads/merge\` &&
+ test x\$(git rev-parse --verify refs/heads/svn^2) = \
+ x\$(git rev-parse --verify refs/heads/merge) &&
git cat-file commit refs/heads/svn^ | grep '^friend$'
"
@@ -80,10 +80,10 @@ test_expect_success 'git svn dcommit merges' "
test_debug 'gitk --all & sleep 1'
test_expect_success 'verify post-merge ancestry' "
- test x\`git rev-parse --verify refs/heads/svn\` = \
- x\`git rev-parse --verify refs/remotes/origin/trunk \` &&
- test x\`git rev-parse --verify refs/heads/svn^2\` = \
- x\`git rev-parse --verify refs/heads/merge\` &&
+ test x\$(git rev-parse --verify refs/heads/svn) = \
+ x\$(git rev-parse --verify refs/remotes/origin/trunk) &&
+ test x\$(git rev-parse --verify refs/heads/svn^2) = \
+ x\$(git rev-parse --verify refs/heads/merge) &&
git cat-file commit refs/heads/svn^ | grep '^friend$'
"
--
2.5.0
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 10/10] t9118-git-svn-funky-branch-names.sh: use the $( ... ) construct for command substitution
2016-01-12 10:45 [PATCH 00/10] use the $( ... ) construct for command substitution Elia Pinto
` (8 preceding siblings ...)
2016-01-12 10:45 ` [PATCH 09/10] t9114-git-svn-dcommit-merge.sh: " Elia Pinto
@ 2016-01-12 10:45 ` Elia Pinto
9 siblings, 0 replies; 12+ messages in thread
From: Elia Pinto @ 2016-01-12 10:45 UTC (permalink / raw)
To: git; +Cc: Elia Pinto
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>
---
t/t9118-git-svn-funky-branch-names.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/t/t9118-git-svn-funky-branch-names.sh b/t/t9118-git-svn-funky-branch-names.sh
index ed4d136..a221915 100755
--- a/t/t9118-git-svn-funky-branch-names.sh
+++ b/t/t9118-git-svn-funky-branch-names.sh
@@ -35,7 +35,7 @@ test_expect_success 'setup svnrepo' '
# SVN 1.7 will truncate "not-a%40{0]" to just "not-a".
# Look at what SVN wound up naming the branch and use that.
# Be sure to escape the @ if it shows up.
-non_reflog=`svn_cmd ls "$svnrepo/pr ject/branches" | grep not-a | sed 's/\///' | sed 's/@/%40/'`
+non_reflog=$(svn_cmd ls "$svnrepo/pr ject/branches" | grep not-a | sed 's/\///' | sed 's/@/%40/')
test_expect_success 'test clone with funky branch names' '
git svn clone -s "$svnrepo/pr ject" project &&
--
2.5.0
^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH 01/10] t9100-git-svn-basic.sh: use the $( ... ) construct for command substitution
2016-01-12 10:45 ` [PATCH 01/10] t9100-git-svn-basic.sh: " Elia Pinto
@ 2016-01-12 19:56 ` Junio C Hamano
0 siblings, 0 replies; 12+ messages in thread
From: Junio C Hamano @ 2016-01-12 19:56 UTC (permalink / raw)
To: Elia Pinto; +Cc: git
Elia Pinto <gitter.spiros@gmail.com> writes:
> @@ -265,18 +265,18 @@ test_expect_success 'able to dcommit to a subdirectory' "
> git update-index --add d &&
> git commit -m '/bar/d should be in the log' &&
> git svn dcommit -i bar &&
> - test -z \"\`git diff refs/heads/my-bar refs/remotes/bar\`\" &&
> + test -z \"\$(git diff refs/heads/my-bar refs/remotes/bar)\" &&
This is entirely outside the scope of this series, but we may want
to see if it makes it easier to read and maintain to turn executable
part of test_expect_success that is double-quoted to use single
quotes around it instead for many of our tests.
This one is a prime example of it. I do not think the executable
part is getting _any_ benefit from being quoted inside double-quote
pair. All the single quoted strings it uses in the script commands
(e.g. the argument to "git commit -m") can equally be quoted with
double quotes safely, and there is no $variable reference that it
wants to refer to the value of the $variable when the command line
of test_expect_success itself is constructed.
> mkdir newdir &&
> echo new > newdir/dir &&
> git update-index --add newdir/dir &&
> git commit -m 'add a new directory' &&
> git svn dcommit -i bar &&
> - test -z \"\`git diff refs/heads/my-bar refs/remotes/bar\`\" &&
> + test -z \"\$(git diff refs/heads/my-bar refs/remotes/bar)\" &&
> echo foo >> newdir/dir &&
> git update-index newdir/dir &&
> git commit -m 'modify a file in new directory' &&
> git svn dcommit -i bar &&
> - test -z \"\`git diff refs/heads/my-bar refs/remotes/bar\`\"
> + test -z \"\$(git diff refs/heads/my-bar refs/remotes/bar)\"
> "
>
> test_expect_success 'dcommit should not fail with a touched file' '
> @@ -295,7 +295,7 @@ test_expect_success 'able to set-tree to a subdirectory' "
> git update-index d &&
> git commit -m 'update /bar/d' &&
> git svn set-tree -i bar HEAD &&
> - test -z \"\`git diff refs/heads/my-bar refs/remotes/bar\`\"
> + test -z \"\$(git diff refs/heads/my-bar refs/remotes/bar)\"
> "
Likewise.
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2016-01-12 19:56 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-01-12 10:45 [PATCH 00/10] use the $( ... ) construct for command substitution Elia Pinto
2016-01-12 10:45 ` [PATCH 01/10] t9100-git-svn-basic.sh: " Elia Pinto
2016-01-12 19:56 ` Junio C Hamano
2016-01-12 10:45 ` [PATCH 02/10] t9101-git-svn-props.sh: " Elia Pinto
2016-01-12 10:45 ` [PATCH 03/10] t9104-git-svn-follow-parent.sh: " Elia Pinto
2016-01-12 10:45 ` [PATCH 04/10] t9105-git-svn-commit-diff.sh: " Elia Pinto
2016-01-12 10:45 ` [PATCH 05/10] t9107-git-svn-migrate.sh: " Elia Pinto
2016-01-12 10:45 ` [PATCH 06/10] t9108-git-svn-glob.sh: " Elia Pinto
2016-01-12 10:45 ` [PATCH 07/10] t9109-git-svn-multi-glob.sh: " Elia Pinto
2016-01-12 10:45 ` [PATCH 08/10] t9110-git-svn-use-svm-props.sh: " Elia Pinto
2016-01-12 10:45 ` [PATCH 09/10] t9114-git-svn-dcommit-merge.sh: " Elia Pinto
2016-01-12 10:45 ` [PATCH 10/10] t9118-git-svn-funky-branch-names.sh: " Elia Pinto
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.