fix(ci): isolate quality gate from hook git environment
This commit is contained in:
parent
25959f7af1
commit
20d6c1bd7b
1 changed files with 7 additions and 0 deletions
|
|
@ -4,6 +4,13 @@ set -Eeuo pipefail
|
||||||
repository_root=$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)
|
repository_root=$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)
|
||||||
receipt_path=${1:-}
|
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
|
if [[ -z "${receipt_path}" ]]; then
|
||||||
echo "usage: run-hololake-native-quality-gate.sh <receipt-output-outside-repository>" >&2
|
echo "usage: run-hololake-native-quality-gate.sh <receipt-output-outside-repository>" >&2
|
||||||
exit 2
|
exit 2
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue