t: use perl instead of "$PERL_PATH" where applicable

As of the last commit, we can use "perl" instead of "$PERL_PATH" when running tests, as the former is now a function which uses the latter. As the shorter "perl" is easier on the eyes, let's switch to using it everywhere. This is not quite a mechanical s/$PERL_PATH/perl/ replacement, though. There are some places where we invoke perl from a script we generate on the fly, and those scripts do not have access to our internal shell functions. The result can be double-checked by running: ln -s /bin/false bin-wrappers/perl make test which continues to pass even after this patch. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Jeff King committed Oct 28, 2013 at 21:23 UTC 94221d22036f36e10680c0a1e7eafb4bceeb1248
28 files changed +50 -50
t/gitweb-lib.sh
+1 -1
@@ -69,7 +69,7 @@ gitweb_run () {
69 # written to web server logs, so we are not interested in that:
70 # we are interested only in properly formatted errors/warnings
71 rm -f gitweb.log &&
72 - "$PERL_PATH" -- "$SCRIPT_NAME" \
72 + perl -- "$SCRIPT_NAME" \
73 >gitweb.output 2>gitweb.log &&
74 perl -w -e '
75 open O, ">gitweb.headers";
t/lib-git-svn.sh
+2 -2
@@ -29,7 +29,7 @@ export svnrepo
29 svnconf=$PWD/svnconf
30 export svnconf
31
32 -"$PERL_PATH" -w -e "
32 +perl -w -e "
33 use SVN::Core;
34 use SVN::Repos;
35 \$SVN::Core::VERSION gt '1.1.0' or exit(42);
@@ -146,7 +146,7 @@ stop_httpd () {
146 }
147
148 convert_to_rev_db () {
149 - "$PERL_PATH" -w -- - "$@" <<\EOF
149 + perl -w -- - "$@" <<\EOF
150 use strict;
151 @ARGV == 2 or die "usage: convert_to_rev_db <input> <output>";
152 open my $wr, '+>', $ARGV[1] or die "$!: couldn't open: $ARGV[1]";
t/lib-terminal.sh
+2 -2
@@ -19,7 +19,7 @@ test_expect_success PERL 'set up terminal for tests' '
19 then
20 :
21 elif
22 - "$PERL_PATH" "$TEST_DIRECTORY"/test-terminal.perl \
22 + perl "$TEST_DIRECTORY"/test-terminal.perl \
23 sh -c "test -t 1 && test -t 2"
24 then
25 test_set_prereq TTY &&
@@ -29,7 +29,7 @@ test_expect_success PERL 'set up terminal for tests' '
29 echo >&4 "test_terminal: need to declare TTY prerequisite"
30 return 127
31 fi
32 - "$PERL_PATH" "$TEST_DIRECTORY"/test-terminal.perl "$@"
32 + perl "$TEST_DIRECTORY"/test-terminal.perl "$@"
33 }
34 fi
35 '
t/t0202-gettext-perl.sh
+2 -2
@@ -12,7 +12,7 @@ if ! test_have_prereq PERL; then
12 test_done
13 fi
14
15 -"$PERL_PATH" -MTest::More -e 0 2>/dev/null || {
15 +perl -MTest::More -e 0 2>/dev/null || {
16 skip_all="Perl Test::More unavailable, skipping test"
17 test_done
18 }
@@ -22,6 +22,6 @@ test_external_has_tap=1
22
23 test_external_without_stderr \
24 'Perl Git::I18N API' \
25 - "$PERL_PATH" "$TEST_DIRECTORY"/t0202/test.pl
25 + perl "$TEST_DIRECTORY"/t0202/test.pl
26
27 test_done
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_PATH" -e "print reverse <>" <top |
45 + perl -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_PATH" -e "print reverse <>" <top.withsub |
51 + perl -e "print reverse <>" <top.withsub |
52 git mktree >actual &&
53 test_cmp tree.withsub actual
54 '
t/t3300-funny-names.sh
+3 -3
@@ -69,7 +69,7 @@ test_expect_success 'ls-files -z does not quote funny filename' '
69 tabs ," (dq) and spaces
70 EOF
71 git ls-files -z >ls-files.z &&
72 - "$PERL_PATH" -pe "y/\000/\012/" <ls-files.z >current &&
72 + perl -pe "y/\000/\012/" <ls-files.z >current &&
73 test_cmp expected current
74 '
75
@@ -106,7 +106,7 @@ test_expect_success 'diff-index -z does not quote funny filename' '
106 tabs ," (dq) and spaces
107 EOF
108 git diff-index -z --name-status $t0 >diff-index.z &&
109 - "$PERL_PATH" -pe "y/\000/\012/" <diff-index.z >current &&
109 + perl -pe "y/\000/\012/" <diff-index.z >current &&
110 test_cmp expected current
111 '
112
@@ -116,7 +116,7 @@ test_expect_success 'diff-tree -z does not quote funny filename' '
116 tabs ," (dq) and spaces
117 EOF
118 git diff-tree -z --name-status $t0 $t1 >diff-tree.z &&
119 - "$PERL_PATH" -pe y/\\000/\\012/ <diff-tree.z >current &&
119 + perl -pe y/\\000/\\012/ <diff-tree.z >current &&
120 test_cmp expected current
121 '
122
t/t4014-format-patch.sh
+1 -1
@@ -293,7 +293,7 @@ check_threading () {
293 (git format-patch --stdout "$@"; echo $? > status.out) |
294 # Prints everything between the Message-ID and In-Reply-To,
295 # and replaces all Message-ID-lookalikes by a sequence number
296 - "$PERL_PATH" -ne '
296 + perl -ne '
297 if (/^(message-id|references|in-reply-to)/i) {
298 $printing = 1;
299 } elsif (/^\S/) {
t/t4020-diff-external.sh
+1 -1
@@ -177,7 +177,7 @@ test_expect_success 'no diff with -diff' '
177 git diff | grep Binary
178 '
179
180 -echo NULZbetweenZwords | "$PERL_PATH" -pe 'y/Z/\000/' > file
180 +echo NULZbetweenZwords | perl -pe 'y/Z/\000/' > file
181
182 test_expect_success 'force diff with "diff"' '
183 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_PATH" -i.bak -p -e "s/^\$/ /" exp &&
30 + perl -i.bak -p -e "s/^\$/ /" exp &&
31 git config --bool diff.suppressBlankEmpty false &&
32 git diff f > actual &&
33 test_cmp exp actual &&
t/t4103-apply-binary.sh
+2 -2
@@ -23,10 +23,10 @@ test_expect_success 'setup' '
23 git commit -m "Initial Version" 2>/dev/null &&
24
25 git checkout -b binary &&
26 - "$PERL_PATH" -pe "y/x/\000/" <file1 >file3 &&
26 + perl -pe "y/x/\000/" <file1 >file3 &&
27 cat file3 >file4 &&
28 git add file2 &&
29 - "$PERL_PATH" -pe "y/\000/v/" <file3 >file1 &&
29 + perl -pe "y/\000/v/" <file3 >file1 &&
30 rm -f file2 &&
31 git update-index --add --remove file1 file2 file3 file4 &&
32 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_PATH" -pe "y/ijk/\\000\\001\\002/" <file1 >file2 &&
15 + perl -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_PATH" -pe "y/mon/\\000\\001\\002/" <file1 >file2 &&
22 + perl -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_PATH" -pe "s/ .*//" .git/MERGE_RR) &&
81 + sha1=$(perl -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_PATH" -pe "s/ .*//" .git/MERGE_RR) &&
94 + sha1=$(perl -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_PATH" -pe "s/ .*//" .git/MERGE_RR) &&
104 + sha1=$(perl -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_PATH" -pe "y/\012/\000/" >.git/MERGE_RR &&
188 + echo "$sha1 a1" | perl -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_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 &&
16 + perl -e "print \"a\" x 4096;" > a &&
17 + perl -e "print \"b\" x 4096;" > b &&
18 + perl -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_PATH" -e '\''
132 + perl -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_PATH" -i.bak -pe "s/ base /abcdef/" ${pack}.pack &&
101 + perl -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_PATH" -i.bak -pe "s/ delta1 /abcdefgh/" ${pack}.pack &&
158 + perl -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/t5551-http-fetch.sh
+1 -1
@@ -224,7 +224,7 @@ test_expect_success EXPENSIVE 'create 50,000 tags in the repo' '
224 done | git fast-import --export-marks=marks &&
225
226 # now assign tags to all the dangling commits we created above
227 - tag=$("$PERL_PATH" -e "print \"bla\" x 30") &&
227 + tag=$(perl -e "print \"bla\" x 30") &&
228 sed -e "s|^:\([^ ]*\) \(.*\)$|\2 refs/tags/$tag-\1|" <marks >>packed-refs
229 )
230 '
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_PATH" -i.bak -pe "s/second commit/socond commit/" .git/objects/pack/*.pack &&
40 + perl -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_PATH" -e "print reverse <>" > expected &&
28 + perl -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_PATH" -e "print reverse <>" > expected &&
36 + perl -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
@@ -994,7 +994,7 @@ test_expect_success 'status -s submodule summary (clean submodule)' '
994
995 test_expect_success 'status -z implies porcelain' '
996 git status --porcelain |
997 - "$PERL_PATH" -pe "s/\012/\000/g" >expect &&
997 + perl -pe "s/\012/\000/g" >expect &&
998 git status -z >output &&
999 test_cmp expect output
1000 '
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_PATH" -w -e '
32 + LC_ALL="$a_utf8_locale" svn log `git svn info --url` | perl -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_PATH" -i.bak -p -e "s/^58$/5588/" file &&
24 - "$PERL_PATH" -i.bak -p -e "s/^61$/6611/" file &&
23 + perl -i.bak -p -e "s/^58$/5588/" file &&
24 + perl -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_PATH" -i.bak -p -e 's/^4\$/4444/' file &&
44 - "$PERL_PATH" -i.bak -p -e 's/^7\$/7777/' file &&
43 + perl -i.bak -p -e 's/^4\$/4444/' file &&
44 + perl -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_PATH" -e '
15 + perl -e '
16 my $len = $ARGV[1];
17 while ($len > 0) {
18 my $s;
t/t9350-fast-export.sh
+1 -1
@@ -429,7 +429,7 @@ test_expect_success 'fast-export quotes pathnames' '
429 --cacheinfo 100644 $blob "path with \\backslash" \
430 --cacheinfo 100644 $blob "path with space" &&
431 git commit -m addition &&
432 - git ls-files -z -s | "$PERL_PATH" -0pe "s{\\t}{$&subdir/}" >index &&
432 + git ls-files -z -s | perl -0pe "s{\\t}{$&subdir/}" >index &&
433 git read-tree --empty &&
434 git update-index -z --index-info <index &&
435 git commit -m rename &&
t/t9400-git-cvsserver-server.sh
+1 -1
@@ -20,7 +20,7 @@ then
20 skip_all='skipping git-cvsserver tests, cvs not found'
21 test_done
22 fi
23 -"$PERL_PATH" -e 'use DBI; use DBD::SQLite' >/dev/null 2>&1 || {
23 +perl -e 'use DBI; use DBD::SQLite' >/dev/null 2>&1 || {
24 skip_all='skipping git-cvsserver tests, Perl SQLite interface unavailable'
25 test_done
26 }
t/t9401-git-cvsserver-crlf.sh
+1 -1
@@ -68,7 +68,7 @@ then
68 skip_all='skipping git-cvsserver tests, perl not available'
69 test_done
70 fi
71 -"$PERL_PATH" -e 'use DBI; use DBD::SQLite' >/dev/null 2>&1 || {
71 +perl -e 'use DBI; use DBD::SQLite' >/dev/null 2>&1 || {
72 skip_all='skipping git-cvsserver tests, Perl SQLite interface unavailable'
73 test_done
74 }
t/t9402-git-cvsserver-refs.sh
+1 -1
@@ -76,7 +76,7 @@ then
76 skip_all='skipping git-cvsserver tests, perl not available'
77 test_done
78 fi
79 -"$PERL_PATH" -e 'use DBI; use DBD::SQLite' >/dev/null 2>&1 || {
79 +perl -e 'use DBI; use DBD::SQLite' >/dev/null 2>&1 || {
80 skip_all='skipping git-cvsserver tests, Perl SQLite interface unavailable'
81 test_done
82 }
t/t9700-perl-git.sh
+2 -2
@@ -11,7 +11,7 @@ if ! test_have_prereq PERL; then
11 test_done
12 fi
13
14 -"$PERL_PATH" -MTest::More -e 0 2>/dev/null || {
14 +perl -MTest::More -e 0 2>/dev/null || {
15 skip_all="Perl Test::More unavailable, skipping test"
16 test_done
17 }
@@ -55,6 +55,6 @@ test_external_has_tap=1
55
56 test_external_without_stderr \
57 'Perl API' \
58 - "$PERL_PATH" "$TEST_DIRECTORY"/t9700/test.pl
58 + perl "$TEST_DIRECTORY"/t9700/test.pl
59
60 test_done
t/t9810-git-p4-rcs.sh
+1 -1
@@ -263,7 +263,7 @@ test_expect_success 'cope with rcs keyword expansion damage' '
263 git config git-p4.attemptRCSCleanup true &&
264 (cd "$cli" && p4_append_to_file kwfile1.c) &&
265 old_lines=$(wc -l <kwfile1.c) &&
266 - "$PERL_PATH" -n -i -e "print unless m/Revision:/" kwfile1.c &&
266 + perl -n -i -e "print unless m/Revision:/" kwfile1.c &&
267 new_lines=$(wc -l <kwfile1.c) &&
268 test $new_lines = $(($old_lines - 1)) &&
269
t/test-lib-functions.sh
+3 -3
@@ -76,11 +76,11 @@ test_decode_color () {
76 }
77
78 nul_to_q () {
79 - "$PERL_PATH" -pe 'y/\000/Q/'
79 + perl -pe 'y/\000/Q/'
80 }
81
82 q_to_nul () {
83 - "$PERL_PATH" -pe 'y/Q/\000/'
83 + perl -pe 'y/Q/\000/'
84 }
85
86 q_to_cr () {
@@ -648,7 +648,7 @@ test_seq () {
648 2) ;;
649 *) error "bug in the test script: not 1 or 2 parameters to test_seq" ;;
650 esac
651 - "$PERL_PATH" -le 'print for $ARGV[0]..$ARGV[1]' -- "$@"
651 + perl -le 'print for $ARGV[0]..$ARGV[1]' -- "$@"
652 }
653
654 # This function can be used to schedule some commands to be run