lishwist/scripts/pre-commit
2025-12-10 17:24:14 +09:00

25 lines
547 B
Bash
Executable File

#!/bin/sh
APISNAP=api.snap.txt
./scripts/staged_files_match './scripts/**' 'core/**/*.go' && ./scripts/api_snapshot ./core > core/$APISNAP
if ! git diff --quiet core/$APISNAP; then
echo "There are unstaged changes to $APISNAP"
exit 1
fi
if ./scripts/staged_files_match 'assert/**' 'core/**/*'; then
go test ./core/... || {
echo "./core test failure"
exit 1
}
fi
if ./scripts/staged_files_match 'assert/**' 'http/props/htmlx/**/*.go'; then
go test ./http/props/htmlx/... || {
echo "./http test failure"
exit 1
}
fi