From 3b3e93770ec2c1b74761ea2ada645f82c1e19638 Mon Sep 17 00:00:00 2001 From: oib Date: Mon, 2 Mar 2026 15:50:43 +0100 Subject: [PATCH] fix(git-hook): correct project root path and exclude .git directories from forbidden check - Update cd path from "../.." to properly navigate to project root from scripts directory - Add .git directory exclusion pattern to prevent false positives on git metadata - Remove test_bad_location.py placeholder file --- scripts/git-pre-commit-hook.sh | 4 ++-- test_bad_location.py | 0 2 files changed, 2 insertions(+), 2 deletions(-) delete mode 100644 test_bad_location.py diff --git a/scripts/git-pre-commit-hook.sh b/scripts/git-pre-commit-hook.sh index cc5dcd6c..faf81380 100755 --- a/scripts/git-pre-commit-hook.sh +++ b/scripts/git-pre-commit-hook.sh @@ -4,7 +4,7 @@ echo "🔍 Checking file locations before commit..." # Change to project root -cd "$(dirname "$0")/.." +cd "$(dirname "$0")/../.." # Files that should not be at root ROOT_FORBIDDEN_PATTERNS=( @@ -54,7 +54,7 @@ done # Check for forbidden directories at root for dir in "${ROOT_FORBIDDEN_DIRS[@]}"; do - if [[ -d "$dir" && "$dir" != "." && "$dir" != ".." ]]; then + if [[ -d "$dir" && "$dir" != "." && "$dir" != ".." && ! "$dir" =~ ^\.git ]]; then echo "❌ ERROR: Found directory '$dir' at root level" echo "📁 Suggested location:" diff --git a/test_bad_location.py b/test_bad_location.py deleted file mode 100644 index e69de29b..00000000