From 7971cb0aa3e517a53f0ce6d3ee9bc3179041ccb8 Mon Sep 17 00:00:00 2001 From: John Klug Date: Wed, 25 May 2022 17:12:18 -0500 Subject: mLinux 6 --- scripts/git-hooks/pre-commit | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100755 scripts/git-hooks/pre-commit (limited to 'scripts/git-hooks/pre-commit') diff --git a/scripts/git-hooks/pre-commit b/scripts/git-hooks/pre-commit new file mode 100755 index 0000000..ee010cb --- /dev/null +++ b/scripts/git-hooks/pre-commit @@ -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 " +************************************************************************* +COMMIT INVALID: .gitmodules has a reference to GitLab + +You can't commit 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 + -- cgit v1.2.3