fix(ci): isolate quality gate from hook git environment

This commit is contained in:
冰朔 2026-08-07 13:57:50 +08:00
commit 20d6c1bd7b

View file

@ -4,6 +4,13 @@ set -Eeuo pipefail
repository_root=$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)
receipt_path=${1:-}
# Git exports repository-local environment variables while invoking hooks.
# This repository's hook lives below the actual worktree root, so inherited
# GIT_DIR/GIT_WORK_TREE values can make `git -C` inspect the wrong path and
# falsely report a dirty source tree. Resolve the source root first, then make
# every gate discover that worktree from its explicit `-C` argument.
unset GIT_DIR GIT_WORK_TREE GIT_INDEX_FILE GIT_PREFIX
if [[ -z "${receipt_path}" ]]; then
echo "usage: run-hololake-native-quality-gate.sh <receipt-output-outside-repository>" >&2
exit 2