t9137-git-svn-dcommit-clobber-series.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 11:49 UTC
2525c5170f1088dac0aeb18444041f9fff04761a
1 file changed
+12
-12
t/t9137-git-svn-dcommit-clobber-series.sh
+12
-12
@@ -16,15 +16,15 @@ test_expect_success 'initialize repo' '
16
'
17
18
test_expect_success '(supposedly) non-conflicting change from SVN' '
19
- test x"`sed -n -e 58p < file`" = x58 &&
20
- test x"`sed -n -e 61p < file`" = x61 &&
19
+ test x"$(sed -n -e 58p < file)" = x58 &&
20
+ test x"$(sed -n -e 61p < file)" = x61 &&
21
svn_cmd co "$svnrepo" tmp &&
22
(cd tmp &&
23
perl -i.bak -p -e "s/^58$/5588/" file &&
24
perl -i.bak -p -e "s/^61$/6611/" file &&
25
poke file &&
26
- test x"`sed -n -e 58p < file`" = x5588 &&
27
- test x"`sed -n -e 61p < file`" = x6611 &&
26
+ test x"$(sed -n -e 58p < file)" = x5588 &&
27
+ test x"$(sed -n -e 61p < file)" = x6611 &&
28
svn_cmd commit -m "58 => 5588, 61 => 6611"
29
)
30
'
@@ -38,20 +38,20 @@ test_expect_success 'some unrelated changes to git' "
38
"
39
40
test_expect_success 'change file but in unrelated area' "
41
- test x\"\`sed -n -e 4p < file\`\" = x4 &&
42
- test x\"\`sed -n -e 7p < file\`\" = x7 &&
41
+ test x\"\$(sed -n -e 4p < file)\" = x4 &&
42
+ test x\"\$(sed -n -e 7p < file)\" = x7 &&
43
perl -i.bak -p -e 's/^4\$/4444/' file &&
44
perl -i.bak -p -e 's/^7\$/7777/' file &&
45
- test x\"\`sed -n -e 4p < file\`\" = x4444 &&
46
- test x\"\`sed -n -e 7p < file\`\" = x7777 &&
45
+ test x\"\$(sed -n -e 4p < file)\" = x4444 &&
46
+ test x\"\$(sed -n -e 7p < file)\" = x7777 &&
47
git commit -m '4 => 4444, 7 => 7777' file &&
48
git svn dcommit &&
49
svn_cmd up tmp &&
50
cd tmp &&
51
- test x\"\`sed -n -e 4p < file\`\" = x4444 &&
52
- test x\"\`sed -n -e 7p < file\`\" = x7777 &&
53
- test x\"\`sed -n -e 58p < file\`\" = x5588 &&
54
- test x\"\`sed -n -e 61p < file\`\" = x6611
51
+ test x\"\$(sed -n -e 4p < file)\" = x4444 &&
52
+ test x\"\$(sed -n -e 7p < file)\" = x7777 &&
53
+ test x\"\$(sed -n -e 58p < file)\" = x5588 &&
54
+ test x\"\$(sed -n -e 61p < file)\" = x6611
55
"
56
57
test_expect_success 'attempt to dcommit with a dirty index' '