mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-10 13:28:55 +00:00
[git-tools] Display what parse errors were found.
This commit is contained in:
parent
a06ec8c7fd
commit
5568b2134b
1 changed files with 6 additions and 1 deletions
|
@ -24,6 +24,7 @@ else
|
||||||
fi
|
fi
|
||||||
|
|
||||||
error=0
|
error=0
|
||||||
|
errors=""
|
||||||
|
|
||||||
IFS=$'\n'
|
IFS=$'\n'
|
||||||
# get a list of staged files
|
# get a list of staged files
|
||||||
|
@ -52,15 +53,19 @@ do
|
||||||
|
|
||||||
# check the staged file content for syntax errors
|
# check the staged file content for syntax errors
|
||||||
# using php -l (lint)
|
# 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 ]
|
if [ $? -ne 0 ]
|
||||||
then
|
then
|
||||||
error=1
|
error=1
|
||||||
|
# Swap back in correct filenames
|
||||||
|
errors+=${result//in - on/"$filename"}
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
unset IFS
|
unset IFS
|
||||||
|
|
||||||
if [ $error -eq 1 ]
|
if [ $error -eq 1 ]
|
||||||
then
|
then
|
||||||
|
echo -e "PHP Syntax check failed:";
|
||||||
|
echo -e "$errors" | grep "^Parse error:"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Add table
Reference in a new issue