Skip to content

Commit

Permalink
t4014-format-patch.sh: use the $( ... ) construct for command substit…
Browse files Browse the repository at this point in the history
…ution

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 <gitter.spiros@gmail.com>
Reviewed-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Elia Pinto authored and Junio C Hamano committed Apr 30, 2014
1 parent 4ff0334 commit 54835fc
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions t/t4014-format-patch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ test_expect_success setup '
test_expect_success "format-patch --ignore-if-in-upstream" '
git format-patch --stdout master..side >patch0 &&
cnt=`grep "^From " patch0 | wc -l` &&
cnt=$(grep "^From " patch0 | wc -l) &&
test $cnt = 3
'
Expand All @@ -52,7 +52,7 @@ test_expect_success "format-patch --ignore-if-in-upstream" '
git format-patch --stdout \
--ignore-if-in-upstream master..side >patch1 &&
cnt=`grep "^From " patch1 | wc -l` &&
cnt=$(grep "^From " patch1 | wc -l) &&
test $cnt = 2
'
Expand All @@ -69,23 +69,23 @@ test_expect_success "format-patch doesn't consider merge commits" '
git checkout -b merger master &&
test_tick &&
git merge --no-ff slave &&
cnt=`git format-patch -3 --stdout | grep "^From " | wc -l` &&
cnt=$(git format-patch -3 --stdout | grep "^From " | wc -l) &&
test $cnt = 3
'

test_expect_success "format-patch result applies" '
git checkout -b rebuild-0 master &&
git am -3 patch0 &&
cnt=`git rev-list master.. | wc -l` &&
cnt=$(git rev-list master.. | wc -l) &&
test $cnt = 2
'

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

Expand Down

0 comments on commit 54835fc

Please sign in to comment.