Created
November 11, 2010 23:27
-
-
Save meonkeys/673438 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 | |
while read oldrev newrev refname | |
do | |
if [[ $refname =~ (hotfixes)|(qa)|(dev) ]] ; then | |
echo "ensuring no trivial merges in $refname" >&2 | |
for hash in $(git log --format=%H --merges $oldrev..$newrev) | |
do | |
echo "checking $hash" >&2 | |
if [[ ($refname =~ /qa$ && "$(git log --format=%H ^$hash^2 qa | wc)" == "$(git log --format=%H qa | wc)") | |
|| ($refname =~ /dev$ && "$(git log --format=%H ^$hash^2 dev | wc)" == "$(git log --format=%H dev | wc)") | |
|| ($refname =~ /hotfixes$ && "$(git log --format=%H ^$hash^2 hotfixes | wc)" == "$(git log --format=%H hotfixes | wc)") ]] | |
then | |
echo "Please rebase first, trivial merges are not allowed in $refname." >&2 | |
exit 1 | |
fi | |
done | |
fi | |
done | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment