blob: f0e093b3cbafb405b072dd9a23239b8857b80b24 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
# Reject a commit directly to a branch named 'master' if a branch named
# 'develop' exists
# Allow commit if it's not to master
[ "$(git rev-parse --abbrev-ref HEAD)" = master ] || exit 0
# Allow commit if there's no develop branch
git show-ref --quiet --verify refs/heads/develop || exit 0
# Allow commit if it's a merge. Is there a better way to test this?
! git rev-parse --quiet --verify MERGE_HEAD >/dev/null || exit 0
# Throw toys
printf >&2 'Branch develop exists, commits to master blocked\n'
exit 1
|