This commit is contained in:
sladro 2026-02-11 13:02:43 +08:00
parent f51fcfdf56
commit 378dc94c95

View File

@ -1,14 +1,18 @@
#!/usr/bin/env sh #!/usr/bin/env sh
set -eu set -eu
PYTHON_BIN="${PYTHON:-python}" if command -v py >/dev/null 2>&1; then
if ! command -v "$PYTHON_BIN" >/dev/null 2>&1; then exec py -3 ".githooks/check_staged_java_encoding.py"
PYTHON_BIN="python3"
fi fi
if ! command -v "$PYTHON_BIN" >/dev/null 2>&1; then if command -v python >/dev/null 2>&1; then
echo "pre-commit: Python is required to run encoding checks." >&2 exec python ".githooks/check_staged_java_encoding.py"
exit 1
fi fi
exec "$PYTHON_BIN" ".githooks/check_staged_java_encoding.py" if command -v python3 >/dev/null 2>&1; then
exec python3 ".githooks/check_staged_java_encoding.py"
fi
echo "pre-commit: Python is required to run encoding checks." >&2
echo "Install Python 3 or ensure 'py'/'python' is available in PATH." >&2
exit 1