From 233d1634ad22c7de8de224155c7112ad8c4697f2 Mon Sep 17 00:00:00 2001 From: zichun Date: Thu, 7 May 2026 17:17:46 +0800 Subject: [PATCH] chore(scripts): scope test gate stack detection to tracked files --- scripts/test.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/test.sh b/scripts/test.sh index 35fa783..b40025d 100755 --- a/scripts/test.sh +++ b/scripts/test.sh @@ -21,9 +21,9 @@ if [ -n "${EXTRA_PATH:-}" ]; then export PATH="$EXTRA_PATH:$PATH" fi -# Stack detection (runtime, mode-agnostic) -HAS_BACKEND=0; [ -d backend ] && HAS_BACKEND=1 -HAS_FRONTEND=0; [ -d frontend ] && HAS_FRONTEND=1 +# Stack detection: tracked content only — untracked WIP must not gate pushes +HAS_BACKEND=0; [ -d backend ] && [ -n "$(git ls-files -- backend 2>/dev/null)" ] && HAS_BACKEND=1 +HAS_FRONTEND=0; [ -d frontend ] && [ -n "$(git ls-files -- frontend 2>/dev/null)" ] && HAS_FRONTEND=1 if [ $HAS_BACKEND -eq 0 ] && [ $HAS_FRONTEND -eq 0 ]; then echo "[test.sh] FATAL: neither backend/ nor frontend/ exists" >&2 exit 1 -- libgit2 0.22.2