aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Smith <toonarmy@phpbb.com>2010-04-03 01:53:12 +0100
committerChris Smith <toonarmy@phpbb.com>2010-04-03 01:53:12 +0100
commit5568b2134bfc8aa477d92e573d8a7d3d13264b44 (patch)
tree2c7c317af9de1a93978c8e18f6c5241beeea0e4e /git-tools
parent[git-tools] This script requires bash to run, so point directly to bash. (diff)
downloadphpbb-5568b2134bfc8aa477d92e573d8a7d3d13264b44.tar.gz
phpbb-5568b2134bfc8aa477d92e573d8a7d3d13264b44.tar.bz2
phpbb-5568b2134bfc8aa477d92e573d8a7d3d13264b44.zip
[git-tools] Display what parse errors were found.
Diffstat (limited to 'git-tools')
-rwxr-xr-xgit-tools/hooks/pre-commit7
1 files changed, 6 insertions, 1 deletions
diff --git a/git-tools/hooks/pre-commit b/git-tools/hooks/pre-commit
index 929789e312..a7deea43c5 100755
--- a/git-tools/hooks/pre-commit
+++ b/git-tools/hooks/pre-commit
@@ -24,6 +24,7 @@ else
fi
error=0
+errors=""
IFS=$'\n'
# get a list of staged files
@@ -52,15 +53,19 @@ do
# check the staged file content for syntax errors
# using php -l (lint)
- git cat-file -p $sha | $PHP_BIN -l >/dev/null
+ result=$(git cat-file -p $sha | $PHP_BIN -l)
if [ $? -ne 0 ]
then
error=1
+ # Swap back in correct filenames
+ errors+=${result//in - on/"$filename"}
fi
done
unset IFS
if [ $error -eq 1 ]
then
+ echo -e "PHP Syntax check failed:";
+ echo -e "$errors" | grep "^Parse error:"
exit 1
fi