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 <vfr@lyx.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Vincent van Ravesteijn committed
Jun 11, 2012 at 19:01 UTC
a3428205e6d74542d6441baaa29d1cb1d1064d95
24 files changed
+41
-41
t/t1010-mktree.sh
+2
-2
@@ -42,13 +42,13 @@ test_expect_success 'ls-tree piped to mktree (2)' '
42
'
43
44
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 |
46
git mktree >actual &&
47
test_cmp tree actual
48
'
49
50
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 |
52
git mktree >actual &&
53
test_cmp tree.withsub actual
54
'
t/t3300-funny-names.sh
+3
-3
@@ -71,7 +71,7 @@ test_expect_success 'ls-files -z does not quote funny filename' '
71
tabs ," (dq) and spaces
72
EOF
73
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 &&
75
test_cmp expected current
76
'
77
@@ -108,7 +108,7 @@ test_expect_success 'diff-index -z does not quote funny filename' '
108
tabs ," (dq) and spaces
109
EOF
110
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 &&
112
test_cmp expected current
113
'
114
@@ -118,7 +118,7 @@ test_expect_success 'diff-tree -z does not quote funny filename' '
118
tabs ," (dq) and spaces
119
EOF
120
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 &&
122
test_cmp expected current
123
'
124
t/t4014-format-patch.sh
+1
-1
@@ -243,7 +243,7 @@ check_threading () {
243
(git format-patch --stdout "$@"; echo $? > status.out) |
244
# Prints everything between the Message-ID and In-Reply-To,
245
# and replaces all Message-ID-lookalikes by a sequence number
246
- perl -ne '
246
+ $PERL_PATH -ne '
247
if (/^(message-id|references|in-reply-to)/i) {
248
$printing = 1;
249
} elsif (/^\S/) {
t/t4020-diff-external.sh
+1
-1
@@ -118,7 +118,7 @@ test_expect_success 'no diff with -diff' '
118
git diff | grep Binary
119
'
120
121
-echo NULZbetweenZwords | perl -pe 'y/Z/\000/' > file
121
+echo NULZbetweenZwords | $PERL_PATH -pe 'y/Z/\000/' > file
122
123
test_expect_success 'force diff with "diff"' '
124
echo >.gitattributes "file diff" &&
t/t4029-diff-trailing-space.sh
+1
-1
@@ -27,7 +27,7 @@ test_expect_success \
27
git config --bool diff.suppressBlankEmpty true &&
28
git diff f > actual &&
29
test_cmp exp actual &&
30
- perl -i.bak -p -e "s/^\$/ /" exp &&
30
+ $PERL_PATH -i.bak -p -e "s/^\$/ /" exp &&
31
git config --bool diff.suppressBlankEmpty false &&
32
git diff f > actual &&
33
test_cmp exp actual &&
t/t4030-diff-textconv.sh
+1
-1
@@ -21,7 +21,7 @@ EOF
21
22
cat >hexdump <<'EOF'
23
#!/bin/sh
24
-perl -e '$/ = undef; $_ = <>; s/./ord($&)/ge; print $_' < "$1"
24
+$PERL_PATH -e '$/ = undef; $_ = <>; s/./ord($&)/ge; print $_' < "$1"
25
EOF
26
chmod +x hexdump
27
t/t4031-diff-rewrite-binary.sh
+1
-1
@@ -60,7 +60,7 @@ test_expect_success 'diff --stat counts binary rewrite as 0 lines' '
60
{
61
echo "#!$SHELL_PATH"
62
cat <<'EOF'
63
-perl -e '$/ = undef; $_ = <>; s/./ord($&)/ge; print $_' < "$1"
63
+$PERL_PATH -e '$/ = undef; $_ = <>; s/./ord($&)/ge; print $_' < "$1"
64
EOF
65
} >dump
66
chmod +x dump
t/t4103-apply-binary.sh
+2
-2
@@ -25,10 +25,10 @@ test_expect_success 'setup' "
25
git commit -m 'Initial Version' 2>/dev/null &&
26
27
git checkout -b binary &&
28
- perl -pe 'y/x/\000/' <file1 >file3 &&
28
+ $PERL_PATH -pe 'y/x/\000/' <file1 >file3 &&
29
cat file3 >file4 &&
30
git add file2 &&
31
- perl -pe 'y/\000/v/' <file3 >file1 &&
31
+ $PERL_PATH -pe 'y/\000/v/' <file3 >file1 &&
32
rm -f file2 &&
33
git update-index --add --remove file1 file2 file3 file4 &&
34
git commit -m 'Second Version' &&
t/t4116-apply-reverse.sh
+2
-2
@@ -12,14 +12,14 @@ test_description='git apply in reverse
12
test_expect_success setup '
13
14
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 &&
16
17
git add file1 file2 &&
18
git commit -m initial &&
19
git tag initial &&
20
21
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 &&
23
24
git commit -a -m second &&
25
git tag second &&
t/t4200-rerere.sh
+4
-4
@@ -78,7 +78,7 @@ test_expect_success 'activate rerere, old style (conflicting merge)' '
78
test_might_fail git config --unset rerere.enabled &&
79
test_must_fail git merge first &&
80
81
- sha1=$(perl -pe "s/ .*//" .git/MERGE_RR) &&
81
+ sha1=$($PERL_PATH -pe "s/ .*//" .git/MERGE_RR) &&
82
rr=.git/rr-cache/$sha1 &&
83
grep "^=======\$" $rr/preimage &&
84
! test -f $rr/postimage &&
@@ -91,7 +91,7 @@ test_expect_success 'rerere.enabled works, too' '
91
git reset --hard &&
92
test_must_fail git merge first &&
93
94
- sha1=$(perl -pe "s/ .*//" .git/MERGE_RR) &&
94
+ sha1=$($PERL_PATH -pe "s/ .*//" .git/MERGE_RR) &&
95
rr=.git/rr-cache/$sha1 &&
96
grep ^=======$ $rr/preimage
97
'
@@ -101,7 +101,7 @@ test_expect_success 'set up rr-cache' '
101
git config rerere.enabled true &&
102
git reset --hard &&
103
test_must_fail git merge first &&
104
- sha1=$(perl -pe "s/ .*//" .git/MERGE_RR) &&
104
+ sha1=$($PERL_PATH -pe "s/ .*//" .git/MERGE_RR) &&
105
rr=.git/rr-cache/$sha1
106
'
107
@@ -185,7 +185,7 @@ test_expect_success 'rerere updates postimage timestamp' '
185
186
test_expect_success 'rerere clear' '
187
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 &&
189
git rerere clear &&
190
! test -d $rr
191
'
t/t5300-pack-object.sh
+4
-4
@@ -13,9 +13,9 @@ TRASH=`pwd`
13
test_expect_success \
14
'setup' \
15
'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 &&
19
test-genrandom "seed a" 2097152 > a_big &&
20
test-genrandom "seed b" 2097152 > b_big &&
21
git update-index --add a a_big b b_big c &&
@@ -129,7 +129,7 @@ test_expect_success \
129
cd "$TRASH"
130
131
test_expect_success 'compare delta flavors' '
132
- perl -e '\''
132
+ $PERL_PATH -e '\''
133
defined($_ = -s $_) or die for @ARGV;
134
exit 1 if $ARGV[0] <= $ARGV[1];
135
'\'' test-2-$packname_2.pack test-3-$packname_3.pack
t/t5303-pack-corruption-resilience.sh
+2
-2
@@ -98,7 +98,7 @@ test_expect_success \
98
'create_new_pack &&
99
git prune-packed &&
100
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 &&
102
test_must_fail git cat-file blob $blob_1 > /dev/null &&
103
test_must_fail git cat-file blob $blob_2 > /dev/null &&
104
test_must_fail git cat-file blob $blob_3 > /dev/null'
@@ -155,7 +155,7 @@ test_expect_success \
155
'create_new_pack &&
156
git prune-packed &&
157
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 &&
159
git cat-file blob $blob_1 > /dev/null &&
160
test_must_fail git cat-file blob $blob_2 > /dev/null &&
161
test_must_fail git cat-file blob $blob_3 > /dev/null'
t/t5532-fetch-proxy.sh
+1
-1
@@ -15,7 +15,7 @@ test_expect_success 'setup remote repo' '
15
cat >proxy <<'EOF'
16
#!/bin/sh
17
echo >&2 "proxying for $*"
18
-cmd=`perl -e '
18
+cmd=`$PERL_PATH -e '
19
read(STDIN, $buf, 4);
20
my $n = hex($buf) - 4;
21
read(STDIN, $buf, $n);
t/t5551-http-fetch.sh
+1
-1
@@ -130,7 +130,7 @@ test_expect_success EXPENSIVE 'create 50,000 tags in the repo' '
130
done | git fast-import --export-marks=marks &&
131
132
# 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") &&
134
sed -e "s/^:\(.\+\) \(.\+\)$/\2 refs\/tags\/$tag-\1/" <marks >>packed-refs
135
)
136
'
t/t6011-rev-list-with-bad-commit.sh
+1
-1
@@ -37,7 +37,7 @@ test_expect_success 'verify number of revisions' \
37
38
test_expect_success 'corrupt second commit object' \
39
'
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 &&
41
test_must_fail git fsck --full
42
'
43
t/t6013-rev-list-reverse-parents.sh
+2
-2
@@ -25,7 +25,7 @@ test_expect_success 'set up --reverse example' '
25
26
test_expect_success '--reverse --parents --full-history combines correctly' '
27
git rev-list --parents --full-history master -- foo |
28
- perl -e "print reverse <>" > expected &&
28
+ $PERL_PATH -e "print reverse <>" > expected &&
29
git rev-list --reverse --parents --full-history master -- foo \
30
> actual &&
31
test_cmp actual expected
@@ -33,7 +33,7 @@ test_expect_success '--reverse --parents --full-history combines correctly' '
33
34
test_expect_success '--boundary does too' '
35
git rev-list --boundary --parents --full-history master ^root -- foo |
36
- perl -e "print reverse <>" > expected &&
36
+ $PERL_PATH -e "print reverse <>" > expected &&
37
git rev-list --boundary --reverse --parents --full-history \
38
master ^root -- foo > actual &&
39
test_cmp actual expected
t/t7508-status.sh
+1
-1
@@ -941,7 +941,7 @@ test_expect_success 'status -s submodule summary (clean submodule)' '
941
942
test_expect_success 'status -z implies porcelain' '
943
git status --porcelain |
944
- perl -pe "s/\012/\000/g" >expect &&
944
+ $PERL_PATH -pe "s/\012/\000/g" >expect &&
945
git status -z >output &&
946
test_cmp expect output
947
'
t/t8006-blame-textconv.sh
+1
-1
@@ -10,7 +10,7 @@ find_blame() {
10
cat >helper <<'EOF'
11
#!/bin/sh
12
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"
14
EOF
15
chmod +x helper
16
t/t9129-git-svn-i18n-commitencoding.sh
+1
-1
@@ -29,7 +29,7 @@ fi
29
compare_svn_head_with () {
30
# extract just the log message and strip out committer info.
31
# 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 '
33
use bytes;
34
$/ = ("-"x72) . "\n";
35
my @x = <STDIN>;
t/t9137-git-svn-dcommit-clobber-series.sh
+4
-4
@@ -20,8 +20,8 @@ test_expect_success '(supposedly) non-conflicting change from SVN' '
20
test x"`sed -n -e 61p < file`" = x61 &&
21
svn_cmd co "$svnrepo" tmp &&
22
(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 &&
25
poke file &&
26
test x"`sed -n -e 58p < file`" = x5588 &&
27
test x"`sed -n -e 61p < file`" = x6611 &&
@@ -40,8 +40,8 @@ test_expect_success 'some unrelated changes to git' "
40
test_expect_success 'change file but in unrelated area' "
41
test x\"\`sed -n -e 4p < file\`\" = x4 &&
42
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 &&
45
test x\"\`sed -n -e 4p < file\`\" = x4444 &&
46
test x\"\`sed -n -e 7p < file\`\" = x7777 &&
47
git commit -m '4 => 4444, 7 => 7777' file &&
t/t9300-fast-import.sh
+1
-1
@@ -12,7 +12,7 @@ test_description='test git fast-import utility'
12
# This could be written as "head -c $1", but IRIX "head" does not
13
# support the -c option.
14
head_c () {
15
- perl -e '
15
+ $PERL_PATH -e '
16
my $len = $ARGV[1];
17
while ($len > 0) {
18
my $s;
t/t9350-fast-export.sh
+1
-1
@@ -424,7 +424,7 @@ test_expect_success 'fast-export quotes pathnames' '
424
--cacheinfo 100644 $blob "path with \\backslash" \
425
--cacheinfo 100644 $blob "path with space" &&
426
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 &&
428
git read-tree --empty &&
429
git update-index -z --index-info <index &&
430
git commit -m rename &&
t/t9810-git-p4-rcs.sh
+1
-1
@@ -246,7 +246,7 @@ test_expect_success 'cope with rcs keyword expansion damage' '
246
git config git-p4.attemptRCSCleanup true &&
247
(cd ../cli && p4_append_to_file kwfile1.c) &&
248
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 &&
250
new_lines=$(wc -l <kwfile1.c) &&
251
test $new_lines = $(($old_lines - 1)) &&
252
t/test-lib-functions.sh
+2
-2
@@ -76,11 +76,11 @@ test_decode_color () {
76
}
77
78
nul_to_q () {
79
- perl -pe 'y/\000/Q/'
79
+ $PERL_PATH -pe 'y/\000/Q/'
80
}
81
82
q_to_nul () {
83
- perl -pe 'y/Q/\000/'
83
+ $PERL_PATH -pe 'y/Q/\000/'
84
}
85
86
q_to_cr () {