fix(delete-service): don't git-add paths already removed by git rm

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
nholtware 2026-11-05 12:10:26 -06:00
parent 253b6033c3
commit b133a0d120

View file

@ -158,7 +158,10 @@ gitops_commit_push() {
dry "git -C $GITOPS_DIR add -A $* && git commit -m '$msg' && git push origin main"
return 0
fi
git -C "$GITOPS_DIR" add -A -- "$@"
local p
for p in "$@"; do # paths removed with `git rm` are already staged; add errors on them
if [[ -e $GITOPS_DIR/$p ]]; then git -C "$GITOPS_DIR" add -A -- "$p"; fi
done
if git -C "$GITOPS_DIR" diff --cached --quiet; then
ok "gitops: nothing to commit for: $msg"
return 0