From 9d17d6de832ff1a68b6f7c7bc5f80ee5fa4bebd6 Mon Sep 17 00:00:00 2001 From: Pierre Rouanet Date: Mon, 14 Sep 2026 14:07:12 +0200 Subject: [PATCH] "Already serves this" was indistinguishable from success MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `git diff --quiet` ignores untracked files. A publish whose only change is a *new* file — a Space gaining a module, which is exactly what every one of them has done — therefore found the clone clean, printed "the Space already serves this" and exited 0 without pushing. Nothing distinguishes that from the case it was written for. Staging before comparing, and comparing the index, sees additions, deletions and modifications alike. `git add -A` moves up from just under the commit; nothing else changes. Assisted-by: Claude:claude-opus-5[1m] --- scripts/publish-space.sh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/scripts/publish-space.sh b/scripts/publish-space.sh index 9c6ec9ee..1aea98d1 100755 --- a/scripts/publish-space.sh +++ b/scripts/publish-space.sh @@ -68,13 +68,18 @@ git clone --depth 1 "https://huggingface.co/spaces/$SPACE" "$CLONE" find "$SOURCE" -maxdepth 1 \( -type f -o -type l \) -exec cp -L {} "$CLONE/" \; cd "$CLONE" -if git diff --quiet; then + +# **Staged first, then compared.** `git diff --quiet` ignores untracked files, so a publish whose +# only change is a *new* file reported "the Space already serves this" and pushed nothing — the +# worst answer available, because it is indistinguishable from success. Staging first and then +# diffing the index sees additions, deletions and modifications alike. +git add -A +if git diff --cached --quiet; then echo "the Space already serves this" exit 0 fi REVISION=$(cd "$REPO_ROOT" && git rev-parse --short HEAD) -git add -A git commit -q -m "$NAME from microduck $REVISION" git push echo "pushed. The Space rebuilds in a minute or two — Gradio Spaces install their requirements."