Radish alpha
h
Radicle Heartwood Protocol & Stack
Radicle
Git (anonymous pull)
Log in to clone via SSH
git-hook-template: Check the hook as early as possible, avoiding unnecessary work
Lorenz Leutgeb committed 22 days ago
commit 7a702e3d3b3bc8b9cdd26cb13dcdc7fdda6276f9
parent e6ab7b8bbd33a69f115f6b4b186d7623d86f43aa
1 file changed +8 -8
modified scripts/git-hook-template.sh
@@ -2,6 +2,13 @@
set -e

HOOK_NAME=$(basename "$0")
+

+
if ! [[ "$HOOK_NAME" =~ ^(pre-(commit|push)|post-checkout)$ ]]
+
then
+
    echo "Unknown hook '${HOOK_NAME}'."
+
    exit 1
+
fi
+

SENSITIVE_FILES=("justfile" "build.rs" "rust-toolchain.toml")
BASE_BRANCH="master"

@@ -35,11 +42,4 @@ then
fi

# Execute the appropriate just recipe based on the hook name.
-
case "$HOOK_NAME" in
-
    pre-commit | pre-push | post-checkout)
-
        just "$HOOK_NAME"
-
        ;;
-
    *)
-
        echo "⚠️ Unknown hook: $HOOK_NAME"
-
        exit 1
-
esac
+
just "$HOOK_NAME"