We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 35d1d72 + 59ba5e2 commit a71d494Copy full SHA for a71d494
1 file changed
pre-receive-hooks/require-jira-issue.sh
@@ -0,0 +1,19 @@
1
+#!/bin/bash
2
+#
3
+# check commit messages for JIRA issue numbers formatted as [JIRA-<issue number>]
4
+
5
+REGEX="\[JIRA\-[0-9]*\]"
6
7
+ERROR_MSG="[POLICY] The commit doesn't reference a JIRA issue"
8
9
+while read OLDREV NEWREV REFNAME ; do
10
+ for COMMIT in `git rev-list $OLDREV..$NEWREV`;
11
+ do
12
+ MESSAGE=`git cat-file commit $COMMIT | sed '1,/^$/d'`
13
+ if ! echo $MESSAGE | grep -iqE "$REGEX"; then
14
+ echo "$ERROR_MSG: $MESSAGE" >&2
15
+ exit 1
16
+ fi
17
+ done
18
+done
19
+exit 0
0 commit comments