ticketfrei3/git-hooks/commit-msg
2020-07-11 02:02:40 +02:00

15 lines
399 B
Bash
Executable file

#!/bin/sh
#
# Copyright (C) 2020 by Thomas Lindner <tom@dl6tom.de>
#
# SPDX-License-Identifier: 0BSD
#
# client-side git-hook - checks commit message style
pattern='\[(core|frontend|twitter|telegram|email|xmpp|mastodon|tests|doc|misc)\] [[:upper:]].*[^.]'
head -n 1 "$1" | egrep -x "$pattern" > /dev/null
if [ $? -ne 0 ]; then
echo "commit message doesn't match \"$pattern\"" >&2
exit 1
fi