Radish alpha
h
Radicle Heartwood Protocol & Stack
Radicle
Git (anonymous pull)
Log in to clone via SSH
REVIEW: Check the hook as early as possible, avoiding unnecessary work
Lorenz Leutgeb committed 24 days ago
commit 371e66353ff7a7779a9dc7cb2587e617b520a6fb
parent a45567c3f0f068b34d7347bffaf425c834de98c2
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"

@@ -34,11 +41,4 @@ if [ ${#CHANGED_FILES[@]} -gt 0 ]; 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"