-
-
Save javierg/884230 to your computer and use it in GitHub Desktop.
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/bash | |
## | |
## .git/hooks/post-merge | |
## | |
## Runs all special post-merge hooks | |
## | |
this_dir="$(dirname "$(test -L "$0" && readlink "$0" || echo "$0")")" | |
"$this_dir/require_signoff" | |
"$this_dir/require_ticket_number" |
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/bash | |
## | |
## Checks for commits merged to master without a signoff | |
## | |
msg=`git log HEAD^..HEAD` | |
branch=`git branch 2>/dev/null | grep '^*' | cut -f2- -d' '` | |
if [ "$branch" != "master" ]; then | |
exit 0 | |
elif [ -z "`echo "$msg" | grep '^[[:space:]]*Signed-off-by: '`" ]; then | |
echo -e >&2 \ | |
"---------------------------------------------------------------------------------------------" \ | |
"\n\033[5m\033[31mIt looks like you just merged an unsigned commit! You might want to fix that before you push.\033[0m" \ | |
"\n---------------------------------------------------------------------------------------------" | |
exit 1 | |
fi |
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/bash | |
## | |
## Checks for commits merged to master without a ticket number | |
## | |
msg=`git log HEAD^..HEAD` | |
branch=`git branch 2>/dev/null | grep '^*' | cut -f2- -d' '` | |
if [ "$branch" != "master" ]; then | |
exit 0 | |
elif [ -z "`echo "$msg" | grep -i 'fixes #[[:digit:]]\{1,5\}'`" ]; then | |
echo -e >&2 \ | |
"---------------------------------------------------------------------------------------------------------" \ | |
"\n\033[5m\033[31mIt looks like you just merged a commit with no ticket number! You might want to fix that before you push.\033[0m" \ | |
"\n---------------------------------------------------------------------------------------------------------" | |
exit 1 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment