2017-03-22 21:18:48 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
# This hook runs gitlint on your commit message.
|
|
|
|
|
|
|
|
# If your machine contains a provisioned Zulip development environment, the
|
|
|
|
# linter will be invoked through `vagrant ssh`.
|
|
|
|
|
2017-06-23 22:07:36 +02:00
|
|
|
# Do not invoke gitlint if commit message is empty
|
2018-08-03 02:14:48 +02:00
|
|
|
if grep -q '^[^#]' "$1"; then
|
|
|
|
lint_cmd="cd ~/zulip && python -m gitlint.cli"
|
|
|
|
if \
|
|
|
|
if [ -z "$VIRTUAL_ENV" ] && command -v vagrant > /dev/null && [ -e .vagrant ]; then
|
|
|
|
! vagrant ssh -c "$lint_cmd"
|
|
|
|
else
|
|
|
|
! eval "$lint_cmd"
|
|
|
|
fi < "$1"
|
|
|
|
then
|
2017-06-23 22:07:36 +02:00
|
|
|
echo "WARNING: Your commit message does not match Zulip's style guide."
|
|
|
|
fi
|
2017-03-22 21:18:48 +01:00
|
|
|
fi
|
|
|
|
|
|
|
|
exit 0
|