From 7927f5926d0de606830dff4de235425bfb6853e0 Mon Sep 17 00:00:00 2001 From: alaskowski <alaskowski@ethz.ch> Date: Tue, 14 Feb 2023 15:55:56 +0100 Subject: [PATCH] SSDM-13365: Added a simple git message hook script to be used by development team. --- docs/hooks/commit-msg | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100755 docs/hooks/commit-msg diff --git a/docs/hooks/commit-msg b/docs/hooks/commit-msg new file mode 100755 index 00000000000..8a0b37a0626 --- /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 -- GitLab