use @@PERL@@ in built scripts

Several of the built shell commands invoke a bare "perl" to perform some one-liners. This will use the first perl in the PATH rather than the one specified by the user's SHELL_PATH. We are not asking these perl invocations to do anything exotic, so typically any old system perl will do; however, in some cases the system perl may have unexpected behavior (e.g., by handling line endings differently). We should err on the side of using the perl the user pointed us to. The downside of this is that on systems with a sane perl setup, we no longer find the perl at runtime, but instead point to a static perl (like /usr/bin/perl). That means we will not handle somebody moving perl without rebuilding git, whereas before we tracked it just fine. This is probably not a big deal, though, as the built perl scripts already suffered from this. 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:19 UTC fcb06a8d54e29d12bb8160b978ce78331c95a1bf
4 files changed +5 -5
git-am.sh
+2 -2
@@ -302,7 +302,7 @@ split_patches () {
302 # not starting with Author, From or Date is the
303 # subject, and the body starts with the next nonempty
304 # line not starting with Author, From or Date
305 - perl -ne 'BEGIN { $subject = 0 }
305 + @@PERL@@ -ne 'BEGIN { $subject = 0 }
306 if ($subject > 1) { print ; }
307 elsif (/^\s+$/) { next ; }
308 elsif (/^Author:/) { s/Author/From/ ; print ;}
@@ -334,7 +334,7 @@ split_patches () {
334 # Since we cannot guarantee that the commit message is in
335 # git-friendly format, we put no Subject: line and just consume
336 # all of the message as the body
337 - LANG=C LC_ALL=C perl -M'POSIX qw(strftime)' -ne 'BEGIN { $subject = 0 }
337 + LANG=C LC_ALL=C @@PERL@@ -M'POSIX qw(strftime)' -ne 'BEGIN { $subject = 0 }
338 if ($subject) { print ; }
339 elsif (/^\# User /) { s/\# User/From:/ ; print ; }
340 elsif (/^\# Date /) {
git-instaweb.sh
+1 -1
@@ -581,7 +581,7 @@ EOF
581
582 gitweb_conf() {
583 cat > "$fqgitdir/gitweb/gitweb_config.perl" <<EOF
584 -#!/usr/bin/perl
584 +#!@@PERL@@
585 our \$projectroot = "$(dirname "$fqgitdir")";
586 our \$git_temp = "$fqgitdir/gitweb/tmp";
587 our \$projects_list = \$projectroot;
git-request-pull.sh
+1 -1
@@ -96,7 +96,7 @@ find_matching_ref='
96 }
97 '
98
99 -ref=$(git ls-remote "$url" | perl -e "$find_matching_ref" "$head" "$headrev" "$tag_name")
99 +ref=$(git ls-remote "$url" | @@PERL@@ -e "$find_matching_ref" "$head" "$headrev" "$tag_name")
100
101 url=$(git ls-remote --get-url "$url")
102
git-submodule.sh
+1 -1
@@ -115,7 +115,7 @@ module_list()
115 git ls-files --error-unmatch --stage -- "$@" ||
116 echo "unmatched pathspec exists"
117 ) |
118 - perl -e '
118 + @@PERL@@ -e '
119 my %unmerged = ();
120 my ($null_sha1) = ("0" x 40);
121 my @out = ();