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
|
|
|
|
if [ $(grep '^[^#]' .git/COMMIT_EDITMSG --count) -ne 0 ]; then
|
|
|
|
lint_cmd="cd ~/zulip && cat \"$1\" | python -m gitlint.cli"
|
|
|
|
if [ -z "$VIRTUAL_ENV" ] && `which vagrant > /dev/null` && [ -e .vagrant ]; then
|
|
|
|
vagrant ssh -c "$lint_cmd"
|
|
|
|
else
|
|
|
|
$lint_cmd
|
|
|
|
fi
|
2017-03-22 21:18:48 +01:00
|
|
|
|
2017-06-23 22:07:36 +02:00
|
|
|
if [ $? -ne 0 ]; then
|
|
|
|
echo "WARNING: Your commit message does not match Zulip's style guide."
|
|
|
|
fi
|
2017-03-22 21:18:48 +01:00
|
|
|
fi
|
|
|
|
|
|
|
|
exit 0
|