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.
This commit is contained in:
parent
01ab630085
commit
03ae4072d9
1 changed files with 1 additions and 1 deletions
|
|
@ -95,7 +95,7 @@ if ! git diff-index --quiet HEAD --; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# [3] Untracked files of note (warn only)
|
# [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
|
if [ "$UNTRACKED" -gt 0 ]; then
|
||||||
warn "$UNTRACKED untracked file(s) exist — they won't be deployed."
|
warn "$UNTRACKED untracked file(s) exist — they won't be deployed."
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue