Created
March 9, 2018 10:13
-
-
Save moisseev/90453f0fadd39ce8e58b114baa0a9d8a to your computer and use it in GitHub Desktop.
git hook which adds the value of GH_TAGNAME from Makefile to a commit message
This file contains 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
# <type>: (If applied, this commit will...) <subject> (Max 50 char) | |
# |<---- Using a Maximum Of 50 Characters ---->| | |
#Update to [GH_TAGNAME] | |
# Explain why this change is being made | |
# |<---- Try To Limit Each Line to a Maximum Of 72 Characters ---->| |
This file contains 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/sh | |
BRANCH=$(git branch | grep '*' | sed 's/* //') | |
case $BRANCH in | |
backuppc-devel) PORTDIR='sysutils/backuppc-devel' ;; | |
rspamd-devel) PORTDIR='mail/rspamd-devel' ;; | |
esac | |
GH_TAGNAME=`sed -n -E 's/^GH_TAGNAME=[[:blank:]]+([[:xdigit:]]+)$/\1/p' $PORTDIR/Makefile` | |
sed -i.bak "s/\[GH_TAGNAME\]/$GH_TAGNAME/" "$1" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment