aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOleg Pudeyev <oleg@bsdpower.com>2012-04-03 23:05:15 -0400
committerOleg Pudeyev <oleg@bsdpower.com>2012-04-03 23:05:15 -0400
commit57209a1e680da729cad0a1cd7e9462254edcd6cb (patch)
tree5451969558352d4606cfeafa0f15b55260c40a35
parentMerge remote-tracking branch 'bantu/ticket/10658' into develop-olympus (diff)
downloadphpbb-57209a1e680da729cad0a1cd7e9462254edcd6cb.tar.gz
phpbb-57209a1e680da729cad0a1cd7e9462254edcd6cb.tar.bz2
phpbb-57209a1e680da729cad0a1cd7e9462254edcd6cb.zip
[ticket/10760] Use externally specified PHP_BIN if any.
We have a PHP_BIN variable but we always set it unconditionally, therefore in order to use a different php binary one had to modify the hook script. Instead set PHP_BIN if it is not set. Now one can set PHP_BIN in their environment to use a non-default php binary. PHPBB3-10760
-rwxr-xr-xgit-tools/hooks/pre-commit8
1 files changed, 5 insertions, 3 deletions
diff --git a/git-tools/hooks/pre-commit b/git-tools/hooks/pre-commit
index 4d03359773..a8bb12e96e 100755
--- a/git-tools/hooks/pre-commit
+++ b/git-tools/hooks/pre-commit
@@ -12,8 +12,10 @@
# ln -s ../../git-tools/hooks/pre-commit \\
# .git/hooks/pre-commit
-# NOTE: this is run through /usr/bin/env
-PHP_BIN=php
+if [ -z "$PHP_BIN" ]
+then
+ PHP_BIN=php
+fi
# necessary check for initial commit
if git rev-parse --verify HEAD >/dev/null 2>&1
@@ -64,7 +66,7 @@ do
# check the staged file content for syntax errors
# using php -l (lint)
- result=$(git cat-file -p $sha | /usr/bin/env $PHP_BIN -l 2>/dev/null)
+ result=$(git cat-file -p $sha | $PHP_BIN -l 2>/dev/null)
if [ $? -ne 0 ]
then
error=1