forked from GNUsocial/gnu-social
[TOOLS] In pre-commit hook, only run php-doc-check if some PHP file changed
This commit is contained in:
parent
cbb36c9531
commit
8a280c349f
@ -12,10 +12,7 @@ for staged in ${staged_files}; do
|
|||||||
if [ -f "${staged}" ] && [[ "${staged}" = *.php ]]
|
if [ -f "${staged}" ] && [[ "${staged}" = *.php ]]
|
||||||
then
|
then
|
||||||
# use php-cs-fixer and get flag of correction
|
# use php-cs-fixer and get flag of correction
|
||||||
"${root}/bin/php-cs-fixer" -q fix "${staged}"
|
if "${root}/bin/php-cs-fixer" -q fix "${staged}"
|
||||||
|
|
||||||
# if php-cs-fixer fix works, it returns 0
|
|
||||||
if [ "$?" -eq 0 ]
|
|
||||||
then
|
then
|
||||||
git add "${staged}" # execute git add directly
|
git add "${staged}" # execute git add directly
|
||||||
fi
|
fi
|
||||||
@ -24,7 +21,9 @@ done
|
|||||||
|
|
||||||
echo "Running php-doc-checker"
|
echo "Running php-doc-checker"
|
||||||
|
|
||||||
"${root}/bin/php-doc-check" src plugins components
|
if echo "${staged_files}" | grep -F ".php"; then
|
||||||
|
"${root}/bin/php-doc-check" src plugins components
|
||||||
|
fi
|
||||||
|
|
||||||
# Only commit if there wasn't an error
|
# Only commit if there wasn't an error
|
||||||
exit $?
|
exit $?
|
||||||
|
Loading…
Reference in New Issue
Block a user