tools - Add a git commit-msg hook for MFC'ing
authorAlex Hornung <ahornung@gmail.com>
Sat, 25 Jun 2011 18:18:54 +0000 (19:18 +0100)
committerAlex Hornung <ahornung@gmail.com>
Sat, 25 Jun 2011 18:23:14 +0000 (19:23 +0100)
tools/commit-msg [new file with mode: 0755]

diff --git a/tools/commit-msg b/tools/commit-msg
new file mode 100755 (executable)
index 0000000..844a9a0
--- /dev/null
@@ -0,0 +1,15 @@
+#!/bin/sh
+#
+# This commit-msg hook tries to guess whether the current commit addresses
+# an existing bug based on a number of keywords in the commit message and
+# reminds the committer of MFC'ing it.
+
+lines=`grep -Ei 'CVE|vulnerability|fix|panic|bug|Reported-by|Dragonfly-bug' "$1" | grep -v '^#'`
+
+if [ "$lines" != "" ]; then
+       echo ''
+       echo -n 'NOTE: '
+       echo >&2 This commit seems to fix an existing issue, please \
+               consider MFC\'ing it to the current stable release.
+       echo ''
+fi