gitprotocol-capabilities(5)
gitprotocol-capabilities(5) Manual Page NAME gitprotocol-capabilities - Protocol v0 and v1 capabilities SYNOPSIS <over-the-wire-protocol> DESCRIPTION Note this document describes capabilities for versions 0 and 1 of the pack protocol. For version 2, please refer to the gitprotocol-v2(5) doc. Servers SHOULD support all capabilities defined in this document. On the very first line of the initial server response of either receive-pack and upload-pack the first reference is followed by a NUL byte and then a list of space delimited server capabilities.
These allow the server to declare what it can and cannot support to the client. Client will then send a space separated list of capabilities it wants to be in effect. The client MUST NOT ask for capabilities the server did not say it supports. Server MUST diagnose and abort if capabilities it does not understand were sent. Server MUST NOT ignore capabilities that client requested and server advertised. As a consequence of these rules, server MUST NOT advertise capabilities it does not understand.
The atomic , report-status , report-status-v2 , delete-refs , quiet , and push-cert capabilities are sent and recognized by the receive-pack (push to server) process. The ofs-delta and side-band-64k capabilities are sent and recognized by both upload-pack and receive-pack protocols. The agent and session-id capabilities may optionally be sent in both protocols. All other capabilities are only recognized by the upload-pack (fetch from server) process. multi_ack The multi_ack capability allows the server to return "ACK obj-id continue" as soon as it finds a commit that it can use as a common base, between the client’s wants and the client’s have set.
By sending this early, the server can potentially head off the client from walking any further down that particular branch of the client’s repository history. The client may still need to walk down other branches, sending have lines for those, until the server has a complete cut across the DAG, or the client has said "done". Without multi_ack, a client sends have lines in --date-order until the server has found a common base.
That means the client will send have lines that are already known by the server to be common, because they overlap in time with another branch on which the server hasn’t found a common base yet. For example suppose the client has commits in caps that the server doesn’t and the server has commits in lower case that the client doesn’t, as in the following diagram: +---- u ---------------------- x / +----- y / / a -- b -- c -- d -- E -- F \ +--- Q -- R -- S If the client wants x,y and starts out by saying have F,S, the server doesn’t know what F,S is.
Eventually the client says "have d" and the server sends "ACK d continue" to let the client know to stop walking down that line (so don’t send c-b-a), but it’s not done yet, it needs a base for x. The client keeps going with S-R-Q, until a gets reached, at which point the server has a clear base and it all ends. Without multi_ack the client would have sent that c-b-a chain anyway, interleaved with S-R-Q. multi_ack_detailed This is an extension of multi_ack that permits the client to better understand the server’s in-memory state.
See gitprotocol-pack(5) , section "Packfile Negotiation" for more information. no-done This capability should only be used with the smart HTTP protocol. If multi_ack_detailed and no-done are both present, then the sender is free to immediately send a pack following its first "ACK obj-id ready" message. Without no-done in the smart HTTP protocol, the server session would end and the client has to make another trip to send "done" before the server can send the pack. no-done removes the last round and thus slightly reduces latency. thin-pack A thin pack is one with deltas which reference base objects not contained within the pack (but are known to exist at the receiving end).
This can reduce the network traffic significantly, but it requires the receiving end to know how to "thicken" these packs by adding the missing bases to the pack. The upload-pack server advertises thin-pack when it can generate and send a thin pack. A client requests the thin-pack capability when it understands how to "thicken" it, notifying the server that it can receive such a pack. A client MUST NOT request the thin-pack capability if it cannot turn a thin pack into a self-contained pack.
Receive-pack, on the other hand, is assumed by default to be able to handle thin packs, but can ask the client not to use the feature by advertising the no-thin capability. A client MUST NOT send a thin pack if the server advertises the no-thin capability. The reasons for this asymmetry are historical. The receive-pack program did not exist until after the invention of thin packs, so historically the reference implementation of receive-pack always understood thin packs.
Adding no-thin later allowed receive-pack to disable the feature in a backwards-compatible manner. side-band, side-band-64k This capability means that the server can send, and the client can understand, multiplexed progress reports and error info interleaved with the packfile itself. These two options are mutually exclusive. A modern client always favors side-band-64k . Either mode indicates that the packfile data will be streamed broken up into packets of up to either 1000 bytes in the case of side_band , or 65520 bytes in the case of side_band_64k .
Each packet is made up of a leading 4-byte pkt-line length of how much data is in the packet, followed by a 1-byte stream code, followed by the actual data. The stream code can be one of: 1 - pack data 2 - progress messages 3 - fatal error message just before stream aborts The "side-band-64k" capability came about as a way for newer clients that can handle much larger packets to request packets that are actually crammed nearly full, while maintaining backward compatibility for the older clients.
Further, with side-band and its up to 1000-byte messages, it’s actually 999 bytes of payload and 1 byte for the stream code. With side-band-64k, same deal, you have up to 65519 bytes of data and 1 byte for the stream code. The client MUST send only one of "side-band" and "side- band-64k". The server MUST diagnose it as an error if client requests both. ofs-delta The server can send, and the client can understand, PACKv2 with delta referring to its base by position in pack rather than by an obj-id.
That is, they can send/read OBJ_OFS_DELTA (aka type 6) in a packfile. agent The server may optionally send a capability of the form agent=X to notify the client that the server is running version X . The client may optionally return its own agent string by responding with an agent=Y capability (but it MUST NOT do so if the server did not mention the agent capability). The X and Y strings may contain any printable ASCII characters except space (i.e., the byte range 32 < x < 127), and are typically of the form "package/version" (e.g., "git/1.8.3.1").
The agent strings are purely informative for statistics and debugging purposes, and MUST NOT be used to programmatically assume the presence or absence of particular features. object-format This capability, which takes a hash algorithm as an argument, indicates that the server supports the given hash algorithms. It may be sent multiple times; if so, the first one given is the one used in the ref advertisement. When provided by the client, this indicates that it intends to use the given hash algorithm to communicate.
The algorithm provided must be one that the server supports. If this capability is not provided, it is assumed that the only supported algorithm is SHA-1. symref This parameterized capability is used to inform the receiver which symbolic ref points to which ref; for example, "symref=HEAD:refs/heads/master" tells the receiver that HEAD points to master. This capability can be repeated to represent multiple symrefs. Servers SHOULD include this capab
The rest of this page is on the live site.