From 2a3f5bc5dbf86872737ce2ce965261991b3b79f0 Mon Sep 17 00:00:00 2001 From: EliteMasterEric Date: Mon, 9 Oct 2023 12:02:19 -0400 Subject: [PATCH] Added Git Hooks --- .github/hooks/README.md | 5 +++++ .github/hooks/post-checkout | 2 ++ .github/hooks/post-merge | 2 ++ .github/hooks/pre-push | 5 +++++ 4 files changed, 14 insertions(+) create mode 100644 .github/hooks/README.md create mode 100644 .github/hooks/post-checkout create mode 100644 .github/hooks/post-merge create mode 100644 .github/hooks/pre-push diff --git a/.github/hooks/README.md b/.github/hooks/README.md new file mode 100644 index 000000000..544fbf365 --- /dev/null +++ b/.github/hooks/README.md @@ -0,0 +1,5 @@ +# Git Hooks +These work even on Windows because of Git Bash. + +## Setup +`git config core.hooksPath .github/hooks` diff --git a/.github/hooks/post-checkout b/.github/hooks/post-checkout new file mode 100644 index 000000000..12358c998 --- /dev/null +++ b/.github/hooks/post-checkout @@ -0,0 +1,2 @@ +#!/bin/sh +git submodule update --init --recursive diff --git a/.github/hooks/post-merge b/.github/hooks/post-merge new file mode 100644 index 000000000..12358c998 --- /dev/null +++ b/.github/hooks/post-merge @@ -0,0 +1,2 @@ +#!/bin/sh +git submodule update --init --recursive diff --git a/.github/hooks/pre-push b/.github/hooks/pre-push new file mode 100644 index 000000000..ec4c820ac --- /dev/null +++ b/.github/hooks/pre-push @@ -0,0 +1,5 @@ +#!/bin/sh +if git diff --cached --submodule | grep -q "^+"; then + echo "WARNING: You have unpushed changes in submodules." + exit 1 +fi