[PATCH 07/10] t9109-git-svn-multi-glob.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/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

--
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]