pub enum ProtocolVersion {
V0,
V2,
}Expand description
Which version of the smart protocol a connection speaks.
The server does not choose. Over SSH the client asks by sending
GIT_PROTOCOL=version=2 as an environment variable, and a client that
cannot, or a transport that drops it, gets v0. gunnar-ssh reads the
variable off the channel and passes the answer in.
Variants§
V0
The original protocol: a reference advertisement, then want/have.
V2
Command-oriented, capability-negotiated protocol v2.
Implementations§
Source§impl ProtocolVersion
impl ProtocolVersion
Sourcepub fn from_git_protocol(value: Option<&str>) -> Self
pub fn from_git_protocol(value: Option<&str>) -> Self
Parse the GIT_PROTOCOL environment variable.
The value is a colon-separated list of key=value, of which gunnar
only cares about version. Anything that is not version=2 is v0:
absent, malformed, version=1.
Protocol v1 is deliberately treated as v0 rather than rejected:
v1 is v0 preceded by a single version 1 pkt-line, and git’s own
version discovery treats a missing one as v0 and carries on. Answering
a v1 request with a v0 advertisement therefore works, where refusing it
would break a client for no benefit.