fix(pre-commit): only re-stage files that were already staged

Prevents accidentally staging unrelated work-in-progress files when
the formatter modifies files during pre-commit hook.
This commit is contained in:
rcourtman
2026-01-17 14:41:32 +00:00
parent 3096ec53b5
commit a9f342c09e

View File

@@ -49,7 +49,8 @@ if [ -f frontend-modern/package.json ]; then
cd ..
fi
# Stage formatted files
git add -u
# Re-stage only files that were already staged (to pick up formatter changes)
# This avoids accidentally committing unrelated work-in-progress files
git diff --cached --name-only -z | xargs -0 -r git add
echo "Pre-commit checks passed!"