1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-05-07 09:16:13 +02:00

Make templates honour SHELL_PATH and PERL_PATH

The hook script templates were hard coded to use /bin/sh and perl.
This patch ensures that they use the same tools specified for the rest
of the suite.

The impetus for the change was noticing that, as shipped, some of the
hooks used shell constructs that wouldn't work under Solaris' /bin/sh
(eg: $(cmd...) substitutions).

Signed-off-by: Ben Walton <bwalton@artsci.utoronto.ca>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Ben Walton 2010-03-20 10:48:08 -04:00 committed by Junio C Hamano
parent f1ba1c90e1
commit 502be95953
4 changed files with 19 additions and 6 deletions

View File

@ -1469,7 +1469,7 @@ endif
ifndef NO_PYTHON
$(QUIET_SUBDIR0)git_remote_helpers $(QUIET_SUBDIR1) PYTHON_PATH='$(PYTHON_PATH_SQ)' prefix='$(prefix_SQ)' all
endif
$(QUIET_SUBDIR0)templates $(QUIET_SUBDIR1)
$(QUIET_SUBDIR0)templates $(QUIET_SUBDIR1) SHELL_PATH='$(SHELL_PATH_SQ)' PERL_PATH='$(PERL_PATH_SQ)'
please_set_SHELL_PATH_to_a_more_modern_shell:
@$$(:)

View File

@ -11,6 +11,16 @@ prefix ?= $(HOME)
template_instdir ?= $(prefix)/share/git-core/templates
# DESTDIR=
ifndef SHELL_PATH
SHELL_PATH = /bin/sh
endif
ifndef PERL_PATH
PERL_PATH = perl
endif
SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH))
PERL_PATH_SQ = $(subst ','\'',$(PERL_PATH))
# Shell quote (do not use $(call) to accommodate ancient setups);
DESTDIR_SQ = $(subst ','\'',$(DESTDIR))
template_instdir_SQ = $(subst ','\'',$(template_instdir))
@ -33,8 +43,11 @@ boilerplates.made : $(bpsrc)
case "$$boilerplate" in \
*--) continue;; \
esac && \
cp $$boilerplate blt/$$dst && \
if test -x "blt/$$dst"; then rx=rx; else rx=r; fi && \
sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
-e 's|@SHELL_PATH@|$(SHELL_PATH_SQ)|' \
-e 's|@PERL_PATH@|$(PERL_PATH_SQ)|g' $$boilerplate > \
blt/$$dst && \
if test -x "$$boilerplate"; then rx=rx; else rx=r; fi && \
chmod a+$$rx "blt/$$dst" || exit; \
done && \
date >$@

View File

@ -65,7 +65,7 @@ then
fi
else
not_in_next=`git-rev-list --pretty=oneline ^${publish} "$topic"`
perl -e '
@PERL_PATH@ -e '
my $topic = $ARGV[0];
my $msg = "* $topic has commits already merged to public branch:\n";
my (%not_in_next) = map {

View File

@ -22,10 +22,10 @@
case "$2,$3" in
merge,)
perl -i.bak -ne 's/^/# /, s/^# #/#/ if /^Conflicts/ .. /#/; print' "$1" ;;
@PERL_PATH@ -i.bak -ne 's/^/# /, s/^# #/#/ if /^Conflicts/ .. /#/; print' "$1" ;;
# ,|template,)
# perl -i.bak -pe '
# @PERL_PATH@ -i.bak -pe '
# print "\n" . `git diff --cached --name-status -r`
# if /^#/ && $first++ == 0' "$1" ;;