[PATCH 03/10] t9104-git-svn-follow-parent.sh: use the $( ... ) construct for command substitution

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]