From 20d6c1bd7b6df658d6c5fbddc54f3e443977b7b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=86=B0=E6=9C=94?= <565183519@qq.com> Date: Fri, 7 Aug 2026 13:57:50 +0800 Subject: [PATCH] fix(ci): isolate quality gate from hook git environment --- .../scripts/run-hololake-native-quality-gate.sh | 7 +++++++ 1 file changed, 7 insertions(+) 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