[#2] Fixed commit hook
parent
e2493e7b19
commit
0007652e68
|
@ -10,9 +10,10 @@ issue_num=`echo "$branch" | grep -Po '^[0-9]+(?=-)'`
|
||||||
if ! grep -q '([0-9]\+)$' "$1"; then
|
if ! grep -q '([0-9]\+)$' "$1"; then
|
||||||
# Error out if we can't derive issue number
|
# Error out if we can't derive issue number
|
||||||
[[ -z "$issue_num" ]] && {
|
[[ -z "$issue_num" ]] && {
|
||||||
>&2 echo "Couldn't derive issue number from branch. Please add one manually."; exit 1;
|
>&2 echo "Couldn't derive issue number from branch. Please add one manually.";
|
||||||
|
exit 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
# Append issue number
|
# Append issue number, and remove all comments
|
||||||
echo "(#$issue_num)" >> "$1"
|
echo "[#$issue_num]" "$(cat "$1")" > "$1"
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -5,10 +5,10 @@
|
||||||
|
|
||||||
branch=`git rev-parse --abbrev-ref HEAD`
|
branch=`git rev-parse --abbrev-ref HEAD`
|
||||||
|
|
||||||
# Just lint the code before committing
|
|
||||||
make lint
|
|
||||||
|
|
||||||
# TODO should we add release branches here as well?
|
# TODO should we add release branches here as well?
|
||||||
if [[ "$branch" =~ ^master|develop$ ]]; then
|
if [[ "$branch" =~ ^master|develop$ ]]; then
|
||||||
make test
|
make test > /dev/null 2>&1 || {
|
||||||
|
>&2 echo "Tests failed. check 'make test' for more info.";
|
||||||
|
exit 1;
|
||||||
|
}
|
||||||
fi
|
fi
|
||||||
|
|
Reference in New Issue