Skip to content

Commit e6ce6f4

Browse files
devzero2000gitster
authored andcommitted
t4012-diff-binary.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 38b2e5d commit e6ce6f4

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

t/t4012-diff-binary.sh

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -67,18 +67,18 @@ test_expect_success C_LOCALE_OUTPUT 'apply detecting corrupt patch correctly' '
6767
git diff >output &&
6868
sed -e "s/-CIT/xCIT/" <output >broken &&
6969
test_must_fail git apply --stat --summary broken 2>detected &&
70-
detected=`cat detected` &&
71-
detected=`expr "$detected" : "fatal.*at line \\([0-9]*\\)\$"` &&
72-
detected=`sed -ne "${detected}p" broken` &&
70+
detected=$(cat detected) &&
71+
detected=$(expr "$detected" : "fatal.*at line \\([0-9]*\\)\$") &&
72+
detected=$(sed -ne "${detected}p" broken) &&
7373
test "$detected" = xCIT
7474
'
7575

7676
test_expect_success C_LOCALE_OUTPUT 'apply detecting corrupt patch correctly' '
7777
git diff --binary | sed -e "s/-CIT/xCIT/" >broken &&
7878
test_must_fail git apply --stat --summary broken 2>detected &&
79-
detected=`cat detected` &&
80-
detected=`expr "$detected" : "fatal.*at line \\([0-9]*\\)\$"` &&
81-
detected=`sed -ne "${detected}p" broken` &&
79+
detected=$(cat detected) &&
80+
detected=$(expr "$detected" : "fatal.*at line \\([0-9]*\\)\$") &&
81+
detected=$(sed -ne "${detected}p" broken) &&
8282
test "$detected" = xCIT
8383
'
8484

@@ -88,15 +88,15 @@ test_expect_success 'initial commit' 'git commit -a -m initial'
8888
test_expect_success 'diff-index with --binary' '
8989
echo AIT >a && mv b e && echo CIT >c && cat e >d &&
9090
git update-index --add --remove a b c d e &&
91-
tree0=`git write-tree` &&
91+
tree0=$(git write-tree) &&
9292
git diff --cached --binary >current &&
9393
git apply --stat --summary current
9494
'
9595

9696
test_expect_success 'apply binary patch' '
9797
git reset --hard &&
9898
git apply --binary --index <current &&
99-
tree1=`git write-tree` &&
99+
tree1=$(git write-tree) &&
100100
test "$tree1" = "$tree0"
101101
'
102102

0 commit comments

Comments
 (0)