#!/usr/bin/env bash
# Enable this pre-commit hook by executing the following from the project root directory
# $ ln -s $PWD/dev-scripts/pre-commit .git/hooks/pre-commit
# Copied from Extension:MobileFrontend and edited. Thanks!

# check for trailing whitespace
if [[ `git diff --cached --check` ]]; then
	git diff --cached --check
	exit 1
fi

if git diff --name-only --cached | grep -P '\.*php$' ; then
	make phplint || exit 1
fi