Skip to content

fix broken .git on push - #280

Open
tikinang wants to merge 1 commit into
mainfrom
fix-broken-git-on-push
Open

tikinang wants to merge 1 commit into
mainfrom
fix-broken-git-on-push

Conversation

@tikinang

@tikinang tikinang commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

Description

Fix broken .git after push - write the temporary git objects to a quarantine dir in tmp instead of the repo, and drop the git prune that deleted staged blobs.

How to reproduce the bug

# 1. A fresh repo with one commit and a valid zerops.yml for your service
mkdir /tmp/zcli-prune-bug && cd /tmp/zcli-prune-bug
git init -q -b main
cat > zerops.yml <<'EOF'
zerops:
  - setup: app
    build:
      base: ubuntu@latest
      deployFiles: ./
    run:
      base: ubuntu@latest
      start: sleep infinity
EOF
git add -A && git commit -qm init

# 2. Stage a new file but do NOT commit it
echo hello > staged.txt
git add staged.txt
BLOB=$(git rev-parse :staged.txt)
git cat-file -t "$BLOB"        # prints: blob

# 3. Push with the default workspace state (all)
zcli push --project-id <PROJECT_ID> --service-id <SERVICE_ID> --setup app --no-wait --disable-logs

# 4. The staged blob is gone and the repo is broken
git cat-file -t "$BLOB"        # fatal: git cat-file: could not get object info
git fsck                       # missing blob <BLOB>
git commit -m "commit staged"  # error: invalid object 100644 <BLOB> for 'staged.txt'
                               # error: Error building trees

@tikinang
tikinang requested a review from MichalSalon October 10, 2026 21:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant