Added git hooks
This commit is contained in:
parent
e60bc35ca2
commit
f804c01849
2 changed files with 36 additions and 0 deletions
13
.hooks/pre-commit
Executable file
13
.hooks/pre-commit
Executable file
|
|
@ -0,0 +1,13 @@
|
|||
#!/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
|
||||
Reference in a new issue