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
'

t/t5300-pack-object.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ TRASH=`pwd`
1313
test_expect_success \
1414
'setup' \
1515
'rm -f .git/index* &&
16-
perl -e "print \"a\" x 4096;" > a &&
17-
perl -e "print \"b\" x 4096;" > b &&
18-
perl -e "print \"c\" x 4096;" > c &&
16+
$PERL_PATH -e "print \"a\" x 4096;" > a &&
17+
$PERL_PATH -e "print \"b\" x 4096;" > b &&
18+
$PERL_PATH -e "print \"c\" x 4096;" > c &&
1919
test-genrandom "seed a" 2097152 > a_big &&
2020
test-genrandom "seed b" 2097152 > b_big &&
2121
git update-index --add a a_big b b_big c &&
@@ -129,7 +129,7 @@ test_expect_success \
129129
cd "$TRASH"
130130

131131
test_expect_success 'compare delta flavors' '
132-
perl -e '\''
132+
$PERL_PATH -e '\''
133133
defined($_ = -s $_) or die for @ARGV;
134134
exit 1 if $ARGV[0] <= $ARGV[1];
135135
'\'' test-2-$packname_2.pack test-3-$packname_3.pack

t/t5303-pack-corruption-resilience.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ test_expect_success \
9898
'create_new_pack &&
9999
git prune-packed &&
100100
chmod +w ${pack}.pack &&
101-
perl -i.bak -pe "s/ base /abcdef/" ${pack}.pack &&
101+
$PERL_PATH -i.bak -pe "s/ base /abcdef/" ${pack}.pack &&
102102
test_must_fail git cat-file blob $blob_1 > /dev/null &&
103103
test_must_fail git cat-file blob $blob_2 > /dev/null &&
104104
test_must_fail git cat-file blob $blob_3 > /dev/null'
@@ -155,7 +155,7 @@ test_expect_success \
155155
'create_new_pack &&
156156
git prune-packed &&
157157
chmod +w ${pack}.pack &&
158-
perl -i.bak -pe "s/ delta1 /abcdefgh/" ${pack}.pack &&
158+
$PERL_PATH -i.bak -pe "s/ delta1 /abcdefgh/" ${pack}.pack &&
159159
git cat-file blob $blob_1 > /dev/null &&
160160
test_must_fail git cat-file blob $blob_2 > /dev/null &&
161161
test_must_fail git cat-file blob $blob_3 > /dev/null'

t/t5532-fetch-proxy.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ test_expect_success 'setup remote repo' '
1515
cat >proxy <<'EOF'
1616
#!/bin/sh
1717
echo >&2 "proxying for $*"
18-
cmd=`perl -e '
18+
cmd=`$PERL_PATH -e '
1919
read(STDIN, $buf, 4);
2020
my $n = hex($buf) - 4;
2121
read(STDIN, $buf, $n);

t/t5551-http-fetch.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ test_expect_success EXPENSIVE 'create 50,000 tags in the repo' '
130130
done | git fast-import --export-marks=marks &&
131131
132132
# now assign tags to all the dangling commits we created above
133-
tag=$(perl -e "print \"bla\" x 30") &&
133+
tag=$($PERL_PATH -e "print \"bla\" x 30") &&
134134
sed -e "s/^:\(.\+\) \(.\+\)$/\2 refs\/tags\/$tag-\1/" <marks >>packed-refs
135135
)
136136
'

t/t6011-rev-list-with-bad-commit.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ test_expect_success 'verify number of revisions' \
3737

3838
test_expect_success 'corrupt second commit object' \
3939
'
40-
perl -i.bak -pe "s/second commit/socond commit/" .git/objects/pack/*.pack &&
40+
$PERL_PATH -i.bak -pe "s/second commit/socond commit/" .git/objects/pack/*.pack &&
4141
test_must_fail git fsck --full
4242
'
4343

t/t6013-rev-list-reverse-parents.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,15 @@ test_expect_success 'set up --reverse example' '
2525

2626
test_expect_success '--reverse --parents --full-history combines correctly' '
2727
git rev-list --parents --full-history master -- foo |
28-
perl -e "print reverse <>" > expected &&
28+
$PERL_PATH -e "print reverse <>" > expected &&
2929
git rev-list --reverse --parents --full-history master -- foo \
3030
> actual &&
3131
test_cmp actual expected
3232
'
3333

3434
test_expect_success '--boundary does too' '
3535
git rev-list --boundary --parents --full-history master ^root -- foo |
36-
perl -e "print reverse <>" > expected &&
36+
$PERL_PATH -e "print reverse <>" > expected &&
3737
git rev-list --boundary --reverse --parents --full-history \
3838
master ^root -- foo > actual &&
3939
test_cmp actual expected

t/t7508-status.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -941,7 +941,7 @@ test_expect_success 'status -s submodule summary (clean submodule)' '
941941

942942
test_expect_success 'status -z implies porcelain' '
943943
git status --porcelain |
944-
perl -pe "s/\012/\000/g" >expect &&
944+
$PERL_PATH -pe "s/\012/\000/g" >expect &&
945945
git status -z >output &&
946946
test_cmp expect output
947947
'

t/t8006-blame-textconv.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ find_blame() {
1010
cat >helper <<'EOF'
1111
#!/bin/sh
1212
grep -q '^bin: ' "$1" || { echo "E: $1 is not \"binary\" file" 1>&2; exit 1; }
13-
perl -p -e 's/^bin: /converted: /' "$1"
13+
$PERL_PATH -p -e 's/^bin: /converted: /' "$1"
1414
EOF
1515
chmod +x helper
1616

t/t9129-git-svn-i18n-commitencoding.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ fi
2929
compare_svn_head_with () {
3030
# extract just the log message and strip out committer info.
3131
# don't use --limit here since svn 1.1.x doesn't have it,
32-
LC_ALL="$a_utf8_locale" svn log `git svn info --url` | perl -w -e '
32+
LC_ALL="$a_utf8_locale" svn log `git svn info --url` | $PERL_PATH -w -e '
3333
use bytes;
3434
$/ = ("-"x72) . "\n";
3535
my @x = <STDIN>;

t/t9137-git-svn-dcommit-clobber-series.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ test_expect_success '(supposedly) non-conflicting change from SVN' '
2020
test x"`sed -n -e 61p < file`" = x61 &&
2121
svn_cmd co "$svnrepo" tmp &&
2222
(cd tmp &&
23-
perl -i.bak -p -e "s/^58$/5588/" file &&
24-
perl -i.bak -p -e "s/^61$/6611/" file &&
23+
$PERL_PATH -i.bak -p -e "s/^58$/5588/" file &&
24+
$PERL_PATH -i.bak -p -e "s/^61$/6611/" file &&
2525
poke file &&
2626
test x"`sed -n -e 58p < file`" = x5588 &&
2727
test x"`sed -n -e 61p < file`" = x6611 &&
@@ -40,8 +40,8 @@ test_expect_success 'some unrelated changes to git' "
4040
test_expect_success 'change file but in unrelated area' "
4141
test x\"\`sed -n -e 4p < file\`\" = x4 &&
4242
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 &&
43+
$PERL_PATH -i.bak -p -e 's/^4\$/4444/' file &&
44+
$PERL_PATH -i.bak -p -e 's/^7\$/7777/' file &&
4545
test x\"\`sed -n -e 4p < file\`\" = x4444 &&
4646
test x\"\`sed -n -e 7p < file\`\" = x7777 &&
4747
git commit -m '4 => 4444, 7 => 7777' file &&

t/t9300-fast-import.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ test_description='test git fast-import utility'
1212
# This could be written as "head -c $1", but IRIX "head" does not
1313
# support the -c option.
1414
head_c () {
15-
perl -e '
15+
$PERL_PATH -e '
1616
my $len = $ARGV[1];
1717
while ($len > 0) {
1818
my $s;

t/t9350-fast-export.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -424,7 +424,7 @@ test_expect_success 'fast-export quotes pathnames' '
424424
--cacheinfo 100644 $blob "path with \\backslash" \
425425
--cacheinfo 100644 $blob "path with space" &&
426426
git commit -m addition &&
427-
git ls-files -z -s | perl -0pe "s{\\t}{$&subdir/}" >index &&
427+
git ls-files -z -s | $PERL_PATH -0pe "s{\\t}{$&subdir/}" >index &&
428428
git read-tree --empty &&
429429
git update-index -z --index-info <index &&
430430
git commit -m rename &&

t/t9810-git-p4-rcs.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ test_expect_success 'cope with rcs keyword expansion damage' '
246246
git config git-p4.attemptRCSCleanup true &&
247247
(cd ../cli && p4_append_to_file kwfile1.c) &&
248248
old_lines=$(wc -l <kwfile1.c) &&
249-
perl -n -i -e "print unless m/Revision:/" kwfile1.c &&
249+
$PERL_PATH -n -i -e "print unless m/Revision:/" kwfile1.c &&
250250
new_lines=$(wc -l <kwfile1.c) &&
251251
test $new_lines = $(($old_lines - 1)) &&
252252

t/test-lib-functions.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,11 @@ test_decode_color () {
7676
}
7777

7878
nul_to_q () {
79-
perl -pe 'y/\000/Q/'
79+
$PERL_PATH -pe 'y/\000/Q/'
8080
}
8181

8282
q_to_nul () {
83-
perl -pe 'y/Q/\000/'
83+
$PERL_PATH -pe 'y/Q/\000/'
8484
}
8585

8686
q_to_cr () {

0 commit comments

Comments
 (0)