mirror of
https://github.com/nolen777/eagle0.git
synced 2026-07-28 22:35:42 +00:00
The previous hook ran gazelle but didn't check if it modified any files. This meant commits could go through with non-canonical BUILD files, causing gazelle_test to fail in CI. The new wrapper script: 1. Runs gazelle 2. Checks if any BUILD files were modified 3. Fails with a helpful message if they were, instructing the user to stage changes Also adds a Pre-Commit Checklist section to CLAUDE.md documenting this behavior. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude <noreply@anthropic.com>
20 lines
554 B
Bash
Executable File
20 lines
554 B
Bash
Executable File
#!/bin/bash
|
|
# Pre-commit hook wrapper for gazelle that fails if files are modified.
|
|
# This ensures BUILD files are in canonical format before committing.
|
|
|
|
set -e
|
|
|
|
# Run gazelle
|
|
bazel run //:gazelle 2>/dev/null
|
|
|
|
# Check if any BUILD files were modified
|
|
if ! git diff --quiet -- '*.bazel' '**/BUILD' 'WORKSPACE*'; then
|
|
echo ""
|
|
echo "ERROR: gazelle modified BUILD files. Please stage the changes and retry:"
|
|
echo ""
|
|
git diff --name-only -- '*.bazel' '**/BUILD' 'WORKSPACE*'
|
|
echo ""
|
|
echo "Run: git add -u && git commit"
|
|
exit 1
|
|
fi
|