From 03ae4072d91407f4965e8d6e251511a9109d19fd Mon Sep 17 00:00:00 2001 From: Mannu Date: Sun, 19 Apr 2026 13:21:01 +0530 Subject: [PATCH] fix(deploy): grep with no matches no longer aborts script under set -e The UNTRACKED count used 'git status --short | grep '^??' | wc -l | xargs'. When the working tree is clean, grep exits 1 (no matches found). Combined with 'set -euo pipefail' at the top of the script, that exit 1 killed the script mid-preflight. Fix: use 'grep -c' with '|| true' fallback. grep -c counts matches and prints 0 if none; the fallback handles the exit code so set -e is happy. --- deploy.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deploy.sh b/deploy.sh index 665a03d..9c4a1f2 100755 --- a/deploy.sh +++ b/deploy.sh @@ -95,7 +95,7 @@ if ! git diff-index --quiet HEAD --; then fi # [3] Untracked files of note (warn only) -UNTRACKED=$(git status --short | grep '^??' | wc -l | xargs) +UNTRACKED=$(git status --short | grep -c '^??' || true) if [ "$UNTRACKED" -gt 0 ]; then warn "$UNTRACKED untracked file(s) exist — they won't be deployed." fi