Created
October 11, 2016 22:23
-
-
Save Aricg/bc558cce85c414e9f05bb06fa0185402 to your computer and use it in GitHub Desktop.
goes in the hooks dir, requires the hooks plugin on newer versions of gerrit
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
ref="$(awk -F'newrev' '{print $2}' <<< "$@" | xargs)" | |
log="$(git log --format=%s%b -n 1 "$ref")" | |
if grep -iq "JIRA:*[0-9]*" <<< "$log" | |
then | |
: | |
else | |
echo "Commit rejected, please provide a jira issue in the format JIRA: ISSUE_NUMBER in the commit message" | |
exit 1 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment