diff --git a/docs/hooks/commit-msg b/docs/hooks/commit-msg new file mode 100755 index 0000000000000000000000000000000000000000..8a0b37a062629dec7f8569581ccd79fa30c4046e --- /dev/null +++ b/docs/hooks/commit-msg @@ -0,0 +1,18 @@ +#!/bin/sh +# +# A simple hook script to check the commit log message. +# Called by "git commit" with one argument, the name of the file +# that has the commit message. The hook should exit with non-zero +# status after issuing an appropriate message if it wants to stop the +# commit. +# +# To enable this hook, move it to .git/hooks directory and make it executable. +# Remember to keep the name of the file as "commit-msg". + +commit_regex='(SSDM-[0-9]+:|merge|rebase)' +error_msg="Aborting commit. Your commit message is missing an issue number ('SSDM-XXXX:')" + +if ! grep -iqE "$commit_regex" "$1"; then + echo "$error_msg" >&2 + exit 1 +fi