From e93fb22f1a548668e977ed0927fb1f2ba213608d Mon Sep 17 00:00:00 2001 From: VinPropane Date: Sun, 31 May 2026 19:43:53 -0400 Subject: [PATCH] chore: bash 3.2-safe pre-commit; document hooksPath + gdtoolkit setup. --- client/README.md | 2 +- scripts/git-hooks/pre-commit | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/client/README.md b/client/README.md index 8330929..6f2bf55 100644 --- a/client/README.md +++ b/client/README.md @@ -338,7 +338,7 @@ On **Linux** (including GitHub Actions), the path must be **`gdUnit4`** with a c **Dev (NEO-18):** **`dev_toggle_occluder_obstacle`** (default **Ctrl+Shift+K**) toggles the prototype `Obstacle` visibility/collision in **`main.gd`**. **F9** / **F10** are used by the embedded debugger; use this action instead when the game is running in the editor. -**Git hooks (recommended):** configure hooks from the repo root (once per clone). This sets **`core.hooksPath=scripts/git-hooks`** so Git runs the tracked hooks directly (no copy under `.git/hooks`): +**Git hooks (recommended):** configure hooks from the repo root (once per clone). This sets **`core.hooksPath=scripts/git-hooks`** so Git runs the tracked **`pre-commit`** / **`pre-push`** scripts (bash 3.2+ compatible): ```bash ./scripts/install-git-hooks.sh diff --git a/scripts/git-hooks/pre-commit b/scripts/git-hooks/pre-commit index ff710bd..426303c 100755 --- a/scripts/git-hooks/pre-commit +++ b/scripts/git-hooks/pre-commit @@ -4,7 +4,10 @@ set -euo pipefail repo_root="$(git rev-parse --show-toplevel)" cd "$repo_root" -mapfile -t staged_files < <(git diff --cached --name-only --diff-filter=ACMR) +staged_files=() +while IFS= read -r f; do + staged_files+=("$f") +done < <(git diff --cached --name-only --diff-filter=ACMR) if [[ ${#staged_files[@]} -eq 0 ]]; then exit 0 fi