Skip to content

Commit a342820

Browse files
vfr-nlgitster
authored andcommitted
t: Replace 'perl' by $PERL_PATH
GIT-BUILD-OPTIONS defines PERL_PATH to be used in the test suite. Only a few tests already actually use this variable when perl is needed. The other test just call 'perl' and it might happen that the wrong perl interpreter is used. This becomes problematic on Windows, when the perl interpreter that is compiled and installed on the Windows system is used, because this perl interpreter might introduce some unexpected LF->CRLF conversions. This patch makes sure that $PERL_PATH is used everywhere in the test suite and that the correct perl interpreter is used. Signed-off-by: Vincent van Ravesteijn <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 9bea2b5 commit a342820

24 files changed

+41
-41
lines changed

t/t1010-mktree.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,13 @@ test_expect_success 'ls-tree piped to mktree (2)' '
4242
'
4343

4444
test_expect_success 'ls-tree output in wrong order given to mktree (1)' '
45-
perl -e "print reverse <>" <top |
45+
$PERL_PATH -e "print reverse <>" <top |
4646
git mktree >actual &&
4747
test_cmp tree actual
4848
'
4949

5050
test_expect_success 'ls-tree output in wrong order given to mktree (2)' '
51-
perl -e "print reverse <>" <top.withsub |
51+
$PERL_PATH -e "print reverse <>" <top.withsub |
5252
git mktree >actual &&
5353
test_cmp tree.withsub actual
5454
'

t/t3300-funny-names.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ test_expect_success 'ls-files -z does not quote funny filename' '
7171
tabs ," (dq) and spaces
7272
EOF
7373
git ls-files -z >ls-files.z &&
74-
perl -pe "y/\000/\012/" <ls-files.z >current &&
74+
$PERL_PATH -pe "y/\000/\012/" <ls-files.z >current &&
7575
test_cmp expected current
7676
'
7777

@@ -108,7 +108,7 @@ test_expect_success 'diff-index -z does not quote funny filename' '
108108
tabs ," (dq) and spaces
109109
EOF
110110
git diff-index -z --name-status $t0 >diff-index.z &&
111-
perl -pe "y/\000/\012/" <diff-index.z >current &&
111+
$PERL_PATH -pe "y/\000/\012/" <diff-index.z >current &&
112112
test_cmp expected current
113113
'
114114

@@ -118,7 +118,7 @@ test_expect_success 'diff-tree -z does not quote funny filename' '
118118
tabs ," (dq) and spaces
119119
EOF
120120
git diff-tree -z --name-status $t0 $t1 >diff-tree.z &&
121-
perl -pe y/\\000/\\012/ <diff-tree.z >current &&
121+
$PERL_PATH -pe y/\\000/\\012/ <diff-tree.z >current &&
122122
test_cmp expected current
123123
'
124124

t/t4014-format-patch.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ check_threading () {
243243
(git format-patch --stdout "$@"; echo $? > status.out) |
244244
# Prints everything between the Message-ID and In-Reply-To,
245245
# and replaces all Message-ID-lookalikes by a sequence number
246-
perl -ne '
246+
$PERL_PATH -ne '
247247
if (/^(message-id|references|in-reply-to)/i) {
248248
$printing = 1;
249249
} elsif (/^\S/) {

t/t4020-diff-external.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ test_expect_success 'no diff with -diff' '
118118
git diff | grep Binary
119119
'
120120

121-
echo NULZbetweenZwords | perl -pe 'y/Z/\000/' > file
121+
echo NULZbetweenZwords | $PERL_PATH -pe 'y/Z/\000/' > file
122122

123123
test_expect_success 'force diff with "diff"' '
124124
echo >.gitattributes "file diff" &&

t/t4029-diff-trailing-space.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ test_expect_success \
2727
git config --bool diff.suppressBlankEmpty true &&
2828
git diff f > actual &&
2929
test_cmp exp actual &&
30-
perl -i.bak -p -e "s/^\$/ /" exp &&
30+
$PERL_PATH -i.bak -p -e "s/^\$/ /" exp &&
3131
git config --bool diff.suppressBlankEmpty false &&
3232
git diff f > actual &&
3333
test_cmp exp actual &&

t/t4030-diff-textconv.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ EOF
2121

2222
cat >hexdump <<'EOF'
2323
#!/bin/sh
24-
perl -e '$/ = undef; $_ = <>; s/./ord($&)/ge; print $_' < "$1"
24+
$PERL_PATH -e '$/ = undef; $_ = <>; s/./ord($&)/ge; print $_' < "$1"
2525
EOF
2626
chmod +x hexdump
2727

t/t4031-diff-rewrite-binary.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ test_expect_success 'diff --stat counts binary rewrite as 0 lines' '
6060
{
6161
echo "#!$SHELL_PATH"
6262
cat <<'EOF'
63-
perl -e '$/ = undef; $_ = <>; s/./ord($&)/ge; print $_' < "$1"
63+
$PERL_PATH -e '$/ = undef; $_ = <>; s/./ord($&)/ge; print $_' < "$1"
6464
EOF
6565
} >dump
6666
chmod +x dump

t/t4103-apply-binary.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@ test_expect_success 'setup' "
2525
git commit -m 'Initial Version' 2>/dev/null &&
2626
2727
git checkout -b binary &&
28-
perl -pe 'y/x/\000/' <file1 >file3 &&
28+
$PERL_PATH -pe 'y/x/\000/' <file1 >file3 &&
2929
cat file3 >file4 &&
3030
git add file2 &&
31-
perl -pe 'y/\000/v/' <file3 >file1 &&
31+
$PERL_PATH -pe 'y/\000/v/' <file3 >file1 &&
3232
rm -f file2 &&
3333
git update-index --add --remove file1 file2 file3 file4 &&
3434
git commit -m 'Second Version' &&

t/t4116-apply-reverse.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@ test_description='git apply in reverse
1212
test_expect_success setup '
1313
1414
for i in a b c d e f g h i j k l m n; do echo $i; done >file1 &&
15-
perl -pe "y/ijk/\\000\\001\\002/" <file1 >file2 &&
15+
$PERL_PATH -pe "y/ijk/\\000\\001\\002/" <file1 >file2 &&
1616
1717
git add file1 file2 &&
1818
git commit -m initial &&
1919
git tag initial &&
2020
2121
for i in a b c g h i J K L m o n p q; do echo $i; done >file1 &&
22-
perl -pe "y/mon/\\000\\001\\002/" <file1 >file2 &&
22+
$PERL_PATH -pe "y/mon/\\000\\001\\002/" <file1 >file2 &&
2323
2424
git commit -a -m second &&
2525
git tag second &&

t/t4200-rerere.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ test_expect_success 'activate rerere, old style (conflicting merge)' '
7878
test_might_fail git config --unset rerere.enabled &&
7979
test_must_fail git merge first &&
8080
81-
sha1=$(perl -pe "s/ .*//" .git/MERGE_RR) &&
81+
sha1=$($PERL_PATH -pe "s/ .*//" .git/MERGE_RR) &&
8282
rr=.git/rr-cache/$sha1 &&
8383
grep "^=======\$" $rr/preimage &&
8484
! test -f $rr/postimage &&
@@ -91,7 +91,7 @@ test_expect_success 'rerere.enabled works, too' '
9191
git reset --hard &&
9292
test_must_fail git merge first &&
9393
94-
sha1=$(perl -pe "s/ .*//" .git/MERGE_RR) &&
94+
sha1=$($PERL_PATH -pe "s/ .*//" .git/MERGE_RR) &&
9595
rr=.git/rr-cache/$sha1 &&
9696
grep ^=======$ $rr/preimage
9797
'
@@ -101,7 +101,7 @@ test_expect_success 'set up rr-cache' '
101101
git config rerere.enabled true &&
102102
git reset --hard &&
103103
test_must_fail git merge first &&
104-
sha1=$(perl -pe "s/ .*//" .git/MERGE_RR) &&
104+
sha1=$($PERL_PATH -pe "s/ .*//" .git/MERGE_RR) &&
105105
rr=.git/rr-cache/$sha1
106106
'
107107

@@ -185,7 +185,7 @@ test_expect_success 'rerere updates postimage timestamp' '
185185

186186
test_expect_success 'rerere clear' '
187187
rm $rr/postimage &&
188-
echo "$sha1 a1" | perl -pe "y/\012/\000/" >.git/MERGE_RR &&
188+
echo "$sha1 a1" | $PERL_PATH -pe "y/\012/\000/" >.git/MERGE_RR &&
189189
git rerere clear &&
190190
! test -d $rr
191191
'

0 commit comments

Comments
 (0)