Skip to content

Instantly share code, notes, and snippets.

@lhrb
Created October 18, 2021 20:54
Show Gist options
  • Save lhrb/cc07826a3879b374d53fa9621a616afd to your computer and use it in GitHub Desktop.
Save lhrb/cc07826a3879b374d53fa9621a616afd to your computer and use it in GitHub Desktop.
#!/bin/sh
# https://auscunningham.medium.com/enforcing-git-commit-message-style-b86a45380b0f
# https://devhints.io/git-log-format
msg=`cat $1`
prefix=`echo $msg | grep -w "^(ADD\|UPDATE)"`
if [ -z "$prefix" ]
then
echo $msg
echo "prefix not found"
echo "$prefix"
fi
end=`echo $msg | grep -E "TA-[[:digit:]]{4,}$"`
if [ -z "$end" ]
then
echo "end"
fi
checks=`echo $msg | grep -w "^(ADD\|UPDATE)" | grep -E "TA-[[:digit:]]{4,}$"`
if [ -z "$checks" ]
then
exit 1
else
exit 0
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment