t9101-git-svn-props.sh: use the $( ... ) construct for command substitution
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> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Elia Pinto committed
Jan 12, 2016 at 10:45 UTC
e10de5a054661e5660643c71e878456cb6d63029
1 file changed
+15
-15
t/t9101-git-svn-props.sh
+15
-15
@@ -26,27 +26,27 @@ cd import
26
EOF
27
28
printf "Hello\r\nWorld\r\n" > crlf
29
- a_crlf=`git hash-object -w crlf`
29
+ a_crlf=$(git hash-object -w crlf)
30
printf "Hello\rWorld\r" > cr
31
- a_cr=`git hash-object -w cr`
31
+ a_cr=$(git hash-object -w cr)
32
printf "Hello\nWorld\n" > lf
33
- a_lf=`git hash-object -w lf`
33
+ a_lf=$(git hash-object -w lf)
34
35
printf "Hello\r\nWorld" > ne_crlf
36
- a_ne_crlf=`git hash-object -w ne_crlf`
36
+ a_ne_crlf=$(git hash-object -w ne_crlf)
37
printf "Hello\nWorld" > ne_lf
38
- a_ne_lf=`git hash-object -w ne_lf`
38
+ a_ne_lf=$(git hash-object -w ne_lf)
39
printf "Hello\rWorld" > ne_cr
40
- a_ne_cr=`git hash-object -w ne_cr`
40
+ a_ne_cr=$(git hash-object -w ne_cr)
41
42
touch empty
43
- a_empty=`git hash-object -w empty`
43
+ a_empty=$(git hash-object -w empty)
44
printf "\n" > empty_lf
45
- a_empty_lf=`git hash-object -w empty_lf`
45
+ a_empty_lf=$(git hash-object -w empty_lf)
46
printf "\r" > empty_cr
47
- a_empty_cr=`git hash-object -w empty_cr`
47
+ a_empty_cr=$(git hash-object -w empty_cr)
48
printf "\r\n" > empty_crlf
49
- a_empty_crlf=`git hash-object -w empty_crlf`
49
+ a_empty_crlf=$(git hash-object -w empty_crlf)
50
51
svn_cmd import --no-auto-props -m 'import for git svn' . "$svnrepo" >/dev/null
52
cd ..
@@ -80,7 +80,7 @@ test_expect_success "$name" \
80
git pull . ${remotes_git_svn}'
81
82
expect='/* $Id$ */'
83
-got="`sed -ne 2p kw.c`"
83
+got="$(sed -ne 2p kw.c)"
84
test_expect_success 'raw $Id$ found in kw.c' "test '$expect' = '$got'"
85
86
test_expect_success "propset CR on crlf files" '
@@ -107,8 +107,8 @@ done
107
cd test_wc
108
printf '$Id$\rHello\rWorld\r' > cr
109
printf '$Id$\rHello\rWorld' > ne_cr
110
- a_cr=`printf '$Id$\r\nHello\r\nWorld\r\n' | git hash-object --stdin`
111
- a_ne_cr=`printf '$Id$\r\nHello\r\nWorld' | git hash-object --stdin`
110
+ a_cr=$(printf '$Id$\r\nHello\r\nWorld\r\n' | git hash-object --stdin)
111
+ a_ne_cr=$(printf '$Id$\r\nHello\r\nWorld' | git hash-object --stdin)
112
test_expect_success 'Set CRLF on cr files' \
113
'svn_cmd propset svn:eol-style CRLF cr &&
114
svn_cmd propset svn:eol-style CRLF ne_cr &&
@@ -119,8 +119,8 @@ cd ..
119
test_expect_success 'fetch and pull latest from svn' \
120
'git svn fetch && git pull . ${remotes_git_svn}'
121
122
-b_cr="`git hash-object cr`"
123
-b_ne_cr="`git hash-object ne_cr`"
122
+b_cr="$(git hash-object cr)"
123
+b_ne_cr="$(git hash-object ne_cr)"
124
125
test_expect_success 'CRLF + $Id$' "test '$a_cr' = '$b_cr'"
126
test_expect_success 'CRLF + $Id$ (no newline)' "test '$a_ne_cr' = '$b_ne_cr'"