summaryrefslogtreecommitdiff
path: root/scripts/git-hooks
diff options
context:
space:
mode:
authorJohn Klug <john.klug@multitech.com>2022-05-25 17:12:18 -0500
committerJohn Klug <john.klug@multitech.com>2022-05-25 17:12:18 -0500
commit7971cb0aa3e517a53f0ce6d3ee9bc3179041ccb8 (patch)
tree56e91417e6f937b3956cadcf4973756cebb4a8b0 /scripts/git-hooks
downloadmlinux-7971cb0aa3e517a53f0ce6d3ee9bc3179041ccb8.tar.gz
mlinux-7971cb0aa3e517a53f0ce6d3ee9bc3179041ccb8.tar.bz2
mlinux-7971cb0aa3e517a53f0ce6d3ee9bc3179041ccb8.zip
mLinux 6
Diffstat (limited to 'scripts/git-hooks')
-rwxr-xr-xscripts/git-hooks/post-checkout3
-rwxr-xr-xscripts/git-hooks/post-merge3
-rwxr-xr-xscripts/git-hooks/pre-commit23
-rwxr-xr-xscripts/git-hooks/pre-push23
4 files changed, 52 insertions, 0 deletions
diff --git a/scripts/git-hooks/post-checkout b/scripts/git-hooks/post-checkout
new file mode 100755
index 0000000..4dd578c
--- /dev/null
+++ b/scripts/git-hooks/post-checkout
@@ -0,0 +1,3 @@
+#!/bin/bash
+
+./setup.sh --update
diff --git a/scripts/git-hooks/post-merge b/scripts/git-hooks/post-merge
new file mode 100755
index 0000000..4dd578c
--- /dev/null
+++ b/scripts/git-hooks/post-merge
@@ -0,0 +1,3 @@
+#!/bin/bash
+
+./setup.sh --update
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
+
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
+