diff options
Diffstat (limited to 'scripts/git-hooks/pre-push')
-rwxr-xr-x | scripts/git-hooks/pre-push | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/scripts/git-hooks/pre-push b/scripts/git-hooks/pre-push new file mode 100755 index 0000000..9cacb8f --- /dev/null +++ b/scripts/git-hooks/pre-push @@ -0,0 +1,23 @@ +#!/bin/bash + +currentBranch=$(git branch | sed -n -e 's/^\* \(.*\)/\1/p') + +if [ "$currentBranch" == "master" ]; then + gitlabOccurances=$(grep -c -m1 gitlab .gitmodules) + + if [ $gitlabOccurances -eq 1 ]; then + echo " +************************************************************************* +PUSH ERROR: .gitmodules has a reference to GitLab + +You can't push anything to the master branch that pulls +from GitLab because outsiders won't be able to build it. + +If you need to use a submodule from GitLab, do so from a branch. +*************************************************************************" + exit 1 + fi +fi + +exit 0 # Everything is good + |