diff --git a/lib/common.sh b/lib/common.sh index e510362..8be3057 100644 --- a/lib/common.sh +++ b/lib/common.sh @@ -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