← Winnitude! Search  ·  Reader Mode (860 ms)
Links: Stay in Reader Retro Site Converter Retro Mode: OFF Original Page ↗
GITHUB · 14 LINKS

PushInfo is documented to return a local reference, but a pushed commit need not be a reference · Issue #1624 · gitpython-developers/GitPython

Repository navigation

PushInfo is documented to return a local reference, but a pushed commit need not be a reference  #1624


New issue

New issue

Closed as not planned
Task #2364
Closed as not planned
PushInfo is documented to return a local reference, but a pushed commit need not be a reference #1624 Task #2364 Labels
acknowledged

help wanted

Description

@zfigura's profile zfigura opened on Jul 29, 2023

Hi!

It is a perhaps little known fact that one can use git push to push something that is not a reference, with syntax like

git push 1a2b3c4d:refs/heads/remotebranch

This is possible with GitPython, but subtly broken. The Repo.push() command technically succeeds, but returns a zero-length array and no errors.

This is because when building a PushInfo struct, GitPython expects the local commit that is pushed to be a reference, and this is not always true. When unable to convert the local commit into a reference, GitPython simply gives up and doesn't build that PushInfo.

Fixing this would be relatively trivial, and I'd love to submit the patch to do it (props, by the way, for writing very straightforward and readable code.) The trouble is that this specific detail is documented:

info.local_ref      # Reference pointing to the local reference that was pushed
                    # It is None if the ref was deleted.

and any change we do here would imply breaking the API. How should we deal with this? I'd be glad to implement whatever solution is decided on.

Metadata

Metadata

Assignees

No one assigned

    Labels


    acknowledged

    help wanted

    Type

    Task

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions