mirror of
https://github.com/phpbb/phpbb.git
synced 2025-08-03 15:27:42 +02:00
[git-tools] Some pre-commit enhancements, abolish tempfile
This commit is contained in:
@@ -12,6 +12,8 @@
|
|||||||
# ln -s ../../git-tools/hooks/pre-commit \\
|
# ln -s ../../git-tools/hooks/pre-commit \\
|
||||||
# .git/hooks/pre-commit
|
# .git/hooks/pre-commit
|
||||||
|
|
||||||
|
PHP_BIN=php
|
||||||
|
|
||||||
# necessary check for initial commit
|
# necessary check for initial commit
|
||||||
if git rev-parse --verify HEAD >/dev/null 2>&1
|
if git rev-parse --verify HEAD >/dev/null 2>&1
|
||||||
then
|
then
|
||||||
@@ -27,12 +29,10 @@ error=0
|
|||||||
IFS=" "
|
IFS=" "
|
||||||
for file in $(git diff --cached --name-status $against | grep -v -E '^D' | cut -f2 | grep -E '\.php$')
|
for file in $(git diff --cached --name-status $against | grep -v -E '^D' | cut -f2 | grep -E '\.php$')
|
||||||
do
|
do
|
||||||
# store lint result in a temp file
|
# hide output, but show errors
|
||||||
tempfile=$(mktemp -t "$(basename $0).XXXXXX")
|
if ! $PHP_BIN -l "$file" >/dev/null
|
||||||
if ! php -l "$file" >/dev/null 2>"$tempfile"
|
|
||||||
then
|
then
|
||||||
error=1
|
error=1
|
||||||
cat "$tempfile"
|
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
unset IFS
|
unset IFS
|
||||||
|
Reference in New Issue
Block a user