config-command/utils/git-pre-commit-script
2018-03-30 07:23:28 -07:00

19 lines
387 B
Bash
Executable file

#!/bin/bash
if REV=$(git rev-parse -q --verify HEAD); then
against=HEAD
else
# Initial commit: diff against an empty tree object
against=4b825dc642cb6eb9a060e54bf8d69288fbee4904
fi
FILES=$(git diff-index --name-only --cached --diff-filter=ACMR $against -- | grep .php )
if [ "$FILES" == "" ]; then
echo "No files to check with PHPCS."
exit 0
fi
set -ex
{{PHPCS_BIN}} -s $FILES