diff --git a/product-source/hololake-platform/scripts/run-hololake-native-quality-gate.sh b/product-source/hololake-platform/scripts/run-hololake-native-quality-gate.sh index aaa1495..6bc6a3e 100755 --- a/product-source/hololake-platform/scripts/run-hololake-native-quality-gate.sh +++ b/product-source/hololake-platform/scripts/run-hololake-native-quality-gate.sh @@ -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 " >&2 exit 2