libgit2/libgit2 — pull request #1030 by pwkelley (2012-10-29 17:53:13+00:00)
Title: Reorganize transport architecture

This 3,500-line change reorganizes the transports layer of libgit2 into two tiers.

There are now just two transports: local, and smart. The interface implemented by the transports is the "own_logic" interface that the local transport implemented previously.

The smart transport knows how to speak the git protocol, but it has no knowledge of how to establish a connection between it and another endpoint, or how to move data back and forth. For this, a subtransport interface is declared, and the smart transport delegates this work to the subtransports. Three subtransports are implemented: git, http, and winhttp. (The http and winhttp transports each implement both http and https.)

Subtransports can either be RPC = 0 (persistent connection) or RPC = 1 (request/response). The smart transport handles the differences in its own logic. The git subtransport is RPC = 0, while http and winhttp are both RPC = 1.

Netops.c/netops.h no longer know anything about transports. And consumers of transports are no longer allowed to know as much about their internals. For consumers that liked to poke the 'refs' vector on transport objects, a new `ls()` method has been added to transport objects. This new separation allowed pkt.c/pkt.h and protocol.c/protocol.h to now be part of the smart transport (which is in 3 files).

This isn't a throw-away rewrite of anything. All the code that was there in the transport layer was and is good stuff. What this change does is move that code around substantially and draw new architectural lines. The lines were blurry before.

@carlosmn already looked at an advance copy of this PR from last week. I appreciate the early feedback you gave me on that, Carlos.