Skip to content

Cannot handle empty ReferenceUpdateRequest #1014

@scabala

Description

@scabala

Hello,
I've been trying to implement a Git server using this library. I have encountered an issue when pushing to it. When pushing first time with some commits present in local repo that are not in remote repo, everything is fine. When I try to push again immediately afterwards, push fails. The same action works fine for GitHub, GitLab and other git services.

I have used example from here.

I have done some debugging and pinned it down to updReqDecoder's Decode method. From my investigation, it turns out that git client responds with just flush-pkt line when there are no refs to be updated - in other words, nothing to push by client. However, ReferenceUpdateRequest and its decoder, is coded in such a way that it always expects some refs being sent. That causes it to fail with capabilities delimiter not found - it comes from here.

I've looked at ReferenceUpdateRequest and it is not straightforward for me how to fix it - maybe someone else have better idea? Nonetheless, I can craft a PR if you are willing to accept it.

Thanks for all the hard work on go-git!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions