2018-12-18 02:08:53 +01:00
|
|
|
#!/usr/bin/env bash
|
2017-03-22 21:18:48 +01:00
|
|
|
|
|
|
|
# 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
|
2021-09-17 23:33:57 +02:00
|
|
|
lint_cmd="cd ~/zulip && gitlint"
|
2020-10-15 04:55:57 +02:00
|
|
|
if
|
|
|
|
if [ -z "$VIRTUAL_ENV" ] && command -v vagrant >/dev/null && [ -e .vagrant ]; then
|
2018-08-03 02:14:48 +02:00
|
|
|
! vagrant ssh -c "$lint_cmd"
|
|
|
|
else
|
|
|
|
! eval "$lint_cmd"
|
2020-10-15 04:55:57 +02:00
|
|
|
fi <"$1"
|
2018-08-03 02:14:48 +02:00
|
|
|
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
|