Created
August 6, 2017 06:59
-
-
Save rmandvikar/5486d953fc74b60eba0b46a339f6a16a to your computer and use it in GitHub Desktop.
pre-receive hook with minor changes
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 | |
# Copyright (c) 2016 G. Sylvie Davies. http://bit-booster.com/ | |
# Copyright (c) 2016 torek. http://stackoverflow.com/users/1256452/torek | |
# License: MIT license. https://opensource.org/licenses/MIT | |
while read oldrev newrev refname | |
do | |
if [[ "$refname" == "refs/heads/master" ]]; then | |
MATCH=`git log --first-parent --pretty='%P' $oldrev..$newrev | | |
grep $oldrev | | |
awk '{ print \$1 }'` | |
if [[ "$oldrev" == "$MATCH" ]]; then | |
exit 0 | |
else | |
echo 1>&2 "*** PUSH REJECTED! FOXTROT MERGE BLOCKED!!! ***" | |
exit 1 | |
fi | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment