mirror of
https://github.com/nolen777/eagle0.git
synced 2026-07-28 22:35:42 +00:00
22 lines
596 B
Bash
Executable File
22 lines
596 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
|
|
|
|
export PATH="/opt/homebrew/bin:/usr/local/bin:$PATH"
|
|
|
|
# Run gazelle
|
|
bazel run //:gazelle
|
|
|
|
# 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
|