#!/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 backporting it.

grep -v '^#' "$1" |
	grep -Eiq 'CVE|vulnerability|fix|panic|bug|Reported-by|Dragonfly-bug'
if [ $? -eq 0 ]; then
	echo ''
	echo 'NOTE: This commit seems to fix an existing issue;' \
	     'please consider backporting it to the current stable release.'
	echo ''
fi

exit 0