summaryrefslogtreecommitdiffstats
path: root/pre-commit.sh
diff options
context:
space:
mode:
Diffstat (limited to 'pre-commit.sh')
-rwxr-xr-xpre-commit.sh19
1 files changed, 19 insertions, 0 deletions
diff --git a/pre-commit.sh b/pre-commit.sh
index 80a49fb47c..c97568dd9d 100755
--- a/pre-commit.sh
+++ b/pre-commit.sh
@@ -6,3 +6,22 @@ if [ -z $AWX_IGNORE_BLACK ] ; then
exit 1)
fi
fi
+
+if [ -z $AWX_IGNORE_USER ] ; then
+ FAIL=0
+ export CHANGED_FILES=$(git diff --cached --name-only --diff-filter=AM)
+ if [ -d ./pre-commit-user ] ; then
+ for SCRIPT in `find ./pre-commit-user -executable -type f` ; do
+ echo "Running user pre-commit hook $SCRIPT"
+ $SCRIPT
+ if [ $? != 0 ] ; then
+ echo "User test $SCRIPT failed"
+ FAIL=1
+ fi
+ done
+ fi
+ if [ $FAIL == 1 ] ; then
+ echo "One or more user tests failed, see messages above"
+ exit 1
+ fi
+fi