Thread (11 messages) flat view 11 messages, 1 author, 2016-06-15
DORMANTno replies

Revision v1 of 9 in this series.

Revisions (9)
  1. v1 [diff vs current]
  2. v1 [diff vs current]
  3. v1 [diff vs current]
  4. v1 [diff vs current]
  5. v1 [diff vs current]
  6. v1 [diff vs current]
  7. v1 [diff vs current]
  8. v1 current
  9. v1 [diff vs current]

[PATCH 02/10] t9101-git-svn-props.sh: use the $( ... ) construct for command substitution

From: Elia Pinto <hidden>
Date: 2016-06-15 23:07:42
Subsystem: the rest · Maintainer: Linus Torvalds

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 <redacted>
---
 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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help