Question

I am attempting to implement the smart HTTP transport protocol in an Asp.Net MVC application. Ultimately, my goal is to enforce permissions at a branch level rather than for the whole repository. To this point, I have implemented a parser for the receive-pack and upload-pack headers but I am stuck when it comes to handling the thin packfile that makes up the rest of the request.

From hunting through the libgit2 source it appears the contents of this thin pack file are intended to just be appended to the object database. The bindings for this functionality appear to be currently implemented in libgit2sharp but are encapsulated away from the public api.

Does libgit2sharp provide any public apis for the packbuilder or for the smart transport protocol directly? If not, is there a better way to accomplish this with the libgit2sharp library?

Was it helpful?

Solution

There is an oldish PR which exposes the pack indexer to C# but I never got around to finishing it. As is so often the case in software, the pack builder isn't in libgit2sharp because nobody's cared enough yet to implement it in the mainline repository.

There is no direct access to the on-the-wire protocol parsing, and exposing it would be more work than reimplementing the parser in a nicer language (which I have done previously). There is no server component in libgit2, so it wouldn't do any of the work for you in any case.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top