From 0000001376df34f9de5c714a37627faf64189ce9 Mon Sep 17 00:00:00 2001 From: Hannes Date: Mon, 10 Jun 2024 22:16:51 +0200 Subject: [PATCH] zess: add pre-commit hook to check commit message --- .githooks/commit-msg | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100755 .githooks/commit-msg diff --git a/.githooks/commit-msg b/.githooks/commit-msg new file mode 100755 index 0000000..ba6f5d9 --- /dev/null +++ b/.githooks/commit-msg @@ -0,0 +1,19 @@ +#!/bin/sh + +commit_message=$(<"$1") + +if ! [[ $commit_message =~ ^(vingo:|vinscant:|vinvoor:|zess:) ]]; then + echo "Error: commit message should start with vingo:|vinscant:|vinvoor:|zess: depending on which subproject you are working on." + exit 1 +fi + +if ! [[ $commit_message =~ ^.*:\ [a-z].* ]]; then + echo "Error: first letter after project specifier should be lower case +Example: + vingo: add cheese + ^ + | this one" + exit 1 +fi + +exit 0 \ No newline at end of file