mirror of
https://github.com/qwibitai/nanoclaw.git
synced 2026-06-04 10:14:47 +08:00
fix: only re-stage previously staged files in pre-commit hook
Capture staged file list before prettier runs, then re-add only those files. Prevents pulling in unrelated unstaged changes. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
+4
-1
@@ -1,2 +1,5 @@
|
|||||||
|
staged=$(git diff --cached --name-only --diff-filter=ACM -- 'src/**/*.ts')
|
||||||
pnpm run format:fix
|
pnpm run format:fix
|
||||||
git diff --name-only -- 'src/**/*.ts' | xargs git add 2>/dev/null || true
|
if [ -n "$staged" ]; then
|
||||||
|
echo "$staged" | xargs git add
|
||||||
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user