ticketfrei3/git-hooks/commit-msg

15 lines
399 B
Plaintext
Raw Normal View History

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