summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2010-04-03 19:28:40 (GMT)
committerJunio C Hamano <gitster@pobox.com>2010-04-03 19:28:40 (GMT)
commit0cb050abc2e7f05894f9f79d5330ce4559653af6 (patch)
treeef2ead44c562b088c1d18b2dbdde880f5a78ffc9
parent59d1e01d69865cb2238e01102c6987e4e1d71a32 (diff)
parent100e762a60a691a4978434f1cd5532e19cad39fc (diff)
downloadgit-0cb050abc2e7f05894f9f79d5330ce4559653af6.zip
git-0cb050abc2e7f05894f9f79d5330ce4559653af6.tar.gz
git-0cb050abc2e7f05894f9f79d5330ce4559653af6.tar.bz2
Merge branch 'bw/template-tool-buildconfig'
* bw/template-tool-buildconfig: Modernize git calling conventions in hook templates Make templates honour SHELL_PATH and PERL_PATH
-rw-r--r--Makefile2
-rw-r--r--templates/Makefile17
-rwxr-xr-xtemplates/hooks--commit-msg.sample2
-rwxr-xr-xtemplates/hooks--post-update.sample2
-rwxr-xr-xtemplates/hooks--pre-commit.sample4
-rwxr-xr-xtemplates/hooks--pre-rebase.sample20
-rwxr-xr-xtemplates/hooks--prepare-commit-msg.sample6
-rwxr-xr-xtemplates/hooks--update.sample4
-rw-r--r--templates/info--exclude2
9 files changed, 36 insertions, 23 deletions
diff --git a/Makefile b/Makefile
index 140d19e..a7f2516 100644
--- a/Makefile
+++ b/Makefile
@@ -1480,7 +1480,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:
@$$(:)
diff --git a/templates/Makefile b/templates/Makefile
index 408f013..d22a71a 100644
--- a/templates/Makefile
+++ b/templates/Makefile
@@ -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 >$@
diff --git a/templates/hooks--commit-msg.sample b/templates/hooks--commit-msg.sample
index 6ef1d29..b58d118 100755
--- a/templates/hooks--commit-msg.sample
+++ b/templates/hooks--commit-msg.sample
@@ -1,7 +1,7 @@
#!/bin/sh
#
# An example hook script to check the commit log message.
-# Called by git-commit with one argument, the name of the file
+# Called by "git commit" with one argument, the name of the file
# that has the commit message. The hook should exit with non-zero
# status after issuing an appropriate message if it wants to stop the
# commit. The hook is allowed to edit the commit message file.
diff --git a/templates/hooks--post-update.sample b/templates/hooks--post-update.sample
index 5323b56..ec17ec1 100755
--- a/templates/hooks--post-update.sample
+++ b/templates/hooks--post-update.sample
@@ -5,4 +5,4 @@
#
# To enable this hook, rename this file to "post-update".
-exec git-update-server-info
+exec git update-server-info
diff --git a/templates/hooks--pre-commit.sample b/templates/hooks--pre-commit.sample
index 439eefd..b187c4b 100755
--- a/templates/hooks--pre-commit.sample
+++ b/templates/hooks--pre-commit.sample
@@ -1,13 +1,13 @@
#!/bin/sh
#
# An example hook script to verify what is about to be committed.
-# Called by git-commit with no arguments. The hook should
+# Called by "git commit" with no arguments. The hook should
# exit with non-zero status after issuing an appropriate message if
# it wants to stop the commit.
#
# To enable this hook, rename this file to "pre-commit".
-if git-rev-parse --verify HEAD >/dev/null 2>&1
+if git rev-parse --verify HEAD >/dev/null 2>&1
then
against=HEAD
else
diff --git a/templates/hooks--pre-rebase.sample b/templates/hooks--pre-rebase.sample
index be1b06e..053f111 100755
--- a/templates/hooks--pre-rebase.sample
+++ b/templates/hooks--pre-rebase.sample
@@ -2,7 +2,7 @@
#
# Copyright (c) 2006, 2008 Junio C Hamano
#
-# The "pre-rebase" hook is run just before "git-rebase" starts doing
+# The "pre-rebase" hook is run just before "git rebase" starts doing
# its job, and can prevent the command from running by exiting with
# non-zero status.
#
@@ -43,7 +43,7 @@ git show-ref -q "$topic" || {
}
# Is topic fully merged to master?
-not_in_master=`git-rev-list --pretty=oneline ^master "$topic"`
+not_in_master=`git rev-list --pretty=oneline ^master "$topic"`
if test -z "$not_in_master"
then
echo >&2 "$topic is fully merged to master; better remove it."
@@ -51,11 +51,11 @@ then
fi
# Is topic ever merged to next? If so you should not be rebasing it.
-only_next_1=`git-rev-list ^master "^$topic" ${publish} | sort`
-only_next_2=`git-rev-list ^master ${publish} | sort`
+only_next_1=`git rev-list ^master "^$topic" ${publish} | sort`
+only_next_2=`git rev-list ^master ${publish} | sort`
if test "$only_next_1" = "$only_next_2"
then
- not_in_topic=`git-rev-list "^$topic" master`
+ not_in_topic=`git rev-list "^$topic" master`
if test -z "$not_in_topic"
then
echo >&2 "$topic is already up-to-date with master"
@@ -64,8 +64,8 @@ then
exit 0
fi
else
- not_in_next=`git-rev-list --pretty=oneline ^${publish} "$topic"`
- perl -e '
+ not_in_next=`git rev-list --pretty=oneline ^${publish} "$topic"`
+ @PERL_PATH@ -e '
my $topic = $ARGV[0];
my $msg = "* $topic has commits already merged to public branch:\n";
my (%not_in_next) = map {
@@ -157,13 +157,13 @@ B to be deleted.
To compute (1):
- git-rev-list ^master ^topic next
- git-rev-list ^master next
+ git rev-list ^master ^topic next
+ git rev-list ^master next
if these match, topic has not merged in next at all.
To compute (2):
- git-rev-list master..topic
+ git rev-list master..topic
if this is empty, it is fully merged to "master".
diff --git a/templates/hooks--prepare-commit-msg.sample b/templates/hooks--prepare-commit-msg.sample
index 3652424..86b8f22 100755
--- a/templates/hooks--prepare-commit-msg.sample
+++ b/templates/hooks--prepare-commit-msg.sample
@@ -1,7 +1,7 @@
#!/bin/sh
#
# An example hook script to prepare the commit log message.
-# Called by git-commit with the name of the file that has the
+# Called by "git commit" with the name of the file that has the
# commit message, followed by the description of the commit
# message's source. The hook's purpose is to edit the commit
# message file. If the hook fails with a non-zero status,
@@ -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" ;;
diff --git a/templates/hooks--update.sample b/templates/hooks--update.sample
index fd63b2d..71ab04e 100755
--- a/templates/hooks--update.sample
+++ b/templates/hooks--update.sample
@@ -1,7 +1,7 @@
#!/bin/sh
#
# An example hook script to blocks unannotated tags from entering.
-# Called by git-receive-pack with arguments: refname sha1-old sha1-new
+# Called by "git receive-pack" with arguments: refname sha1-old sha1-new
#
# To enable this hook, rename this file to "update".
#
@@ -64,7 +64,7 @@ zero="0000000000000000000000000000000000000000"
if [ "$newrev" = "$zero" ]; then
newrev_type=delete
else
- newrev_type=$(git-cat-file -t $newrev)
+ newrev_type=$(git cat-file -t $newrev)
fi
case "$refname","$newrev_type" in
diff --git a/templates/info--exclude b/templates/info--exclude
index 2c87b72..a5196d1 100644
--- a/templates/info--exclude
+++ b/templates/info--exclude
@@ -1,4 +1,4 @@
-# git-ls-files --others --exclude-from=.git/info/exclude
+# git ls-files --others --exclude-from=.git/info/exclude
# Lines that start with '#' are comments.
# For a project mostly in C, the following would be a good set of
# exclude patterns (uncomment them if you want to use them):