-
Notifications
You must be signed in to change notification settings - Fork 0
/
commit-msg
executable file
·31 lines (23 loc) · 932 Bytes
/
commit-msg
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/bin/sh
# Verify the commit message.
# TODO: Attempt to determine the commit --cleanup mode and whether #comments
# will be stripped; if so, strip them here before verifying.
unset CDPATH
set -o errexit
# Not clever enough to work when run from a symlink or ". script.sh".
THIS_DIR=$(cd -P "$(dirname "$0")" && pwd)
# Expect the name of the file holding the proposed commit message as the first
# argument.
COMMIT_MESSAGE_FILE=$1
"$THIS_DIR/utilities/validate_commit_message_format.sh" < "$COMMIT_MESSAGE_FILE"
# If aspell is present, check spelling.
if command -v aspell > /dev/null 2>&1
then
# Since git hooks have a stdin of /dev/null, need to manually get to the
# input device.
#
# This will probably cause all kinds of trouble if this commit happens
# from a GUI or anywhere else besides a terminal.
# TODO: Make sure it doesn't crash and burn too hard.
aspell check "$COMMIT_MESSAGE_FILE" < /dev/tty
fi