Skip to content

Commit 54835fc

Browse files
devzero2000gitster
authored andcommitted
t4014-format-patch.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 sed -i 's@`\(.*\)`@$(\1)@g' ${_f} done and then carefully proof-read. Signed-off-by: Elia Pinto <[email protected]> Reviewed-by: Matthieu Moy <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 4ff0334 commit 54835fc

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

t/t4014-format-patch.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ test_expect_success setup '
4343
test_expect_success "format-patch --ignore-if-in-upstream" '
4444
4545
git format-patch --stdout master..side >patch0 &&
46-
cnt=`grep "^From " patch0 | wc -l` &&
46+
cnt=$(grep "^From " patch0 | wc -l) &&
4747
test $cnt = 3
4848
4949
'
@@ -52,7 +52,7 @@ test_expect_success "format-patch --ignore-if-in-upstream" '
5252
5353
git format-patch --stdout \
5454
--ignore-if-in-upstream master..side >patch1 &&
55-
cnt=`grep "^From " patch1 | wc -l` &&
55+
cnt=$(grep "^From " patch1 | wc -l) &&
5656
test $cnt = 2
5757
5858
'
@@ -69,23 +69,23 @@ test_expect_success "format-patch doesn't consider merge commits" '
6969
git checkout -b merger master &&
7070
test_tick &&
7171
git merge --no-ff slave &&
72-
cnt=`git format-patch -3 --stdout | grep "^From " | wc -l` &&
72+
cnt=$(git format-patch -3 --stdout | grep "^From " | wc -l) &&
7373
test $cnt = 3
7474
'
7575

7676
test_expect_success "format-patch result applies" '
7777
7878
git checkout -b rebuild-0 master &&
7979
git am -3 patch0 &&
80-
cnt=`git rev-list master.. | wc -l` &&
80+
cnt=$(git rev-list master.. | wc -l) &&
8181
test $cnt = 2
8282
'
8383

8484
test_expect_success "format-patch --ignore-if-in-upstream result applies" '
8585
8686
git checkout -b rebuild-1 master &&
8787
git am -3 patch1 &&
88-
cnt=`git rev-list master.. | wc -l` &&
88+
cnt=$(git rev-list master.. | wc -l) &&
8989
test $cnt = 2
9090
'
9191

0 commit comments

Comments
 (0)