Files
zulip/tools/commit-msg
Anders Kaseorg 392175d6e8 Use #!/usr/bin/env for bash shebangs.
/bin/sh and /usr/bin/env are the only two binaries that NixOS provides
at a fixed path (outside a buildFHSUserEnv sandbox).

This discussion was split from #11004.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2018-12-17 17:21:08 -08:00

23 lines
639 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 && 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
echo "WARNING: Your commit message does not match Zulip's style guide."
fi
fi
exit 0