Files
zulip/tools/commit-msg
Anders Kaseorg 5ab90c541c requirements: Install gitlint from its Debian package.
gitlint has a bunch of pinned requirements that hold back important
upgrades and conflict with other packages’ requirements.  The gitlint
author has rejected proposals to unpin them because it might increase
the amount of maintenance he needs to do
(https://github.com/jorisroovers/gitlint/pull/133).  That decision is
his to make, but _somebody_ needs to do the maintenance, so we
delegate it to Debian and Ubuntu.  If that means using a significantly
older version of gitlint, that’s a tradeoff we need to make to keep
the rest of our requirements current.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-09-17 17:05:18 -07:00

23 lines
621 B
Bash
Executable File

#!/usr/bin/env 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`.
# Do not invoke gitlint if commit message is empty
if grep -q '^[^#]' "$1"; then
lint_cmd="cd ~/zulip && gitlint"
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
echo "WARNING: Your commit message does not match Zulip's style guide."
fi
fi
exit 0