This repository has been archived on 2021-12-24. You can view files and clone it, but cannot push or open issues/pull-requests.
jos/.hooks/pre-commit

15 lines
384 B
Bash
Executable File

#!/usr/bin/env bash
# This hook lints the code, and if we're on develop or master, also forces the tests to pass.
branch=`git rev-parse --abbrev-ref HEAD`
# TODO should we add release branches here as well?
if [[ "$branch" =~ ^master|develop$ ]]; then
make test > /dev/null 2>&1 || {
>&2 echo "Tests failed. check 'make test' for more info.";
exit 1;
}
fi