Skip to content

Push reports success when the server rejects a ref #41

Closed

Description

@cheat2001

remote::push sets no push_update_reference callback, so when the server rejects one of the refs (non fast-forward, a tag that already exists at a different commit) libgit2 still returns Ok and the toast says "Pushed main to origin". The branch push has always had this gap, but #35 now sends every local tag alongside it, so a stale local tag is the likely way people hit it.

Fix is to set the callback in make_callbacks (or on the PushOptions), collect the per-ref status messages, and turn any rejection into an error naming the ref, same shape as git's ! [rejected] v1.0 -> v1.0 (already exists). Needs an engine test against a bare remote where the tag already points elsewhere.

Activity

  1. cheat2001 commented on Sep 24, 2026

    @cheat2001
    OwnerAuthor

    Fixed in 0.18.0. push sets the update-reference callback now, collects every ref the server refuses and fails naming them, git style (origin rejected tag v1.0 (already exists)). For the record, libgit2's local transport never rejects a tag move, that rule lives in receive-pack, so the engine test only covers the message shape. The callback path still wants one check against a real remote with a moved tag, which I'll do on the next tag push.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions