Created
April 20, 2018 05:12
-
-
Save jsnfwlr/d8cd030446a999adda6d74d4f3cd8a83 to your computer and use it in GitHub Desktop.
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 | |
commit_regex='^\[(GM\w-[0-9]+|HotFix\-[0-9]{4}\/[0-9]{2}\/[0-9]{2})\]\s\w*\s-\s' | |
error_msg="Aborting commit. Your commit message is incomplete.\r\nPlease include the following:\r\n\t - a JIRA Issue number or a HotFix-date\r\n\t - a component label\r\n\t - a summary of what was changed" | |
if [[ $(cat "$1" | grep -icE "$commit_regex") -eq 0 ]]; then | |
echo $(cat "$1" | grep -icE "$commit_regex") | |
printf "$error_msg" >&2 | |
exit 1 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment