Skip to content

Commit fcb06a8

Browse files
peffgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent e45bda8 commit fcb06a8

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

git-am.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ split_patches () {
302302
# not starting with Author, From or Date is the
303303
# subject, and the body starts with the next nonempty
304304
# line not starting with Author, From or Date
305-
perl -ne 'BEGIN { $subject = 0 }
305+
@@PERL@@ -ne 'BEGIN { $subject = 0 }
306306
if ($subject > 1) { print ; }
307307
elsif (/^\s+$/) { next ; }
308308
elsif (/^Author:/) { s/Author/From/ ; print ;}
@@ -334,7 +334,7 @@ split_patches () {
334334
# Since we cannot guarantee that the commit message is in
335335
# git-friendly format, we put no Subject: line and just consume
336336
# 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 }
338338
if ($subject) { print ; }
339339
elsif (/^\# User /) { s/\# User/From:/ ; print ; }
340340
elsif (/^\# Date /) {

git-instaweb.sh

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

582582
gitweb_conf() {
583583
cat > "$fqgitdir/gitweb/gitweb_config.perl" <<EOF
584-
#!/usr/bin/perl
584+
#!@@PERL@@
585585
our \$projectroot = "$(dirname "$fqgitdir")";
586586
our \$git_temp = "$fqgitdir/gitweb/tmp";
587587
our \$projects_list = \$projectroot;

git-request-pull.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ find_matching_ref='
9696
}
9797
'
9898

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")
100100

101101
url=$(git ls-remote --get-url "$url")
102102

git-submodule.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ module_list()
115115
git ls-files --error-unmatch --stage -- "$@" ||
116116
echo "unmatched pathspec exists"
117117
) |
118-
perl -e '
118+
@@PERL@@ -e '
119119
my %unmerged = ();
120120
my ($null_sha1) = ("0" x 40);
121121
my @out = ();

0 commit comments

Comments
 (0)