From 01c7931a6b523c28d856ba05d2d6cd6ac7cc01b2 Mon Sep 17 00:00:00 2001 From: Adam Mathes Date: Sun, 15 Feb 2026 09:25:28 -0800 Subject: Add local git hooks to run 'make check' before push --- scripts/install-hooks.sh | 11 +++++++++++ scripts/pre-push-hook.sh | 14 ++++++++++++++ 2 files changed, 25 insertions(+) create mode 100755 scripts/install-hooks.sh create mode 100644 scripts/pre-push-hook.sh (limited to 'scripts') diff --git a/scripts/install-hooks.sh b/scripts/install-hooks.sh new file mode 100755 index 0000000..6acf800 --- /dev/null +++ b/scripts/install-hooks.sh @@ -0,0 +1,11 @@ +#!/bin/sh + +HOOKS_DIR=$(git rev-parse --git-path hooks) +SCRIPT_DIR=$(dirname "$0") + +echo "Installing git hooks to $HOOKS_DIR..." + +cp "$SCRIPT_DIR/pre-push-hook.sh" "$HOOKS_DIR/pre-push" +chmod +x "$HOOKS_DIR/pre-push" + +echo "Hooks installed successfully." diff --git a/scripts/pre-push-hook.sh b/scripts/pre-push-hook.sh new file mode 100644 index 0000000..a943ed4 --- /dev/null +++ b/scripts/pre-push-hook.sh @@ -0,0 +1,14 @@ +#!/bin/sh + +echo "Running pre-push hooks..." +make check + +RESULT=$? + +if [ $RESULT -ne 0 ]; then + echo "Pre-push check failed. Please fix issues before pushing." + exit 1 +fi + +echo "Pre-push check passed." +exit 0 -- cgit v1.2.3