2 .\" Title: gitprotocol-capabilities
3 .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author]
4 .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/>
7 .\" Source: Git 2.40.0.rc2
10 .TH "GITPROTOCOL\-CAPABIL" "5" "03/06/2023" "Git 2\&.40\&.0\&.rc2" "Git Manual"
11 .\" -----------------------------------------------------------------
12 .\" * Define some portability stuff
13 .\" -----------------------------------------------------------------
14 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
15 .\" http://bugs.debian.org/507673
16 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
17 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
20 .\" -----------------------------------------------------------------
21 .\" * set default formatting
22 .\" -----------------------------------------------------------------
23 .\" disable hyphenation
25 .\" disable justification (adjust text to left margin only)
27 .\" -----------------------------------------------------------------
28 .\" * MAIN CONTENT STARTS HERE *
29 .\" -----------------------------------------------------------------
31 gitprotocol-capabilities \- Protocol v0 and v1 capabilities
35 <over\-the\-wire\-protocol>
44 .nr an-no-space-flag 1
52 this document describes capabilities for versions 0 and 1 of the pack protocol\&. For version 2, please refer to the \fBgitprotocol-v2\fR(5) doc\&.
56 Servers SHOULD support all capabilities defined in this document\&.
58 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\&.
60 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\&.
62 Server MUST diagnose and abort if capabilities it does not understand was 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\&.
64 The \fIatomic\fR, \fIreport\-status\fR, \fIreport\-status\-v2\fR, \fIdelete\-refs\fR, \fIquiet\fR, and \fIpush\-cert\fR capabilities are sent and recognized by the receive\-pack (push to server) process\&.
66 The \fIofs\-delta\fR and \fIside\-band\-64k\fR capabilities are sent and recognized by both upload\-pack and receive\-pack protocols\&. The \fIagent\fR and \fIsession\-id\fR capabilities may optionally be sent in both protocols\&.
68 All other capabilities are only recognized by the upload\-pack (fetch from server) process\&.
71 The \fImulti_ack\fR 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\(cqs wants and the client\(cqs have set\&.
73 By sending this early, the server can potentially head off the client from walking any further down that particular branch of the client\(cqs 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"\&.
75 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 that the server hasn\(cqt found a common base on yet\&.
77 For example suppose the client has commits in caps that the server doesn\(cqt and the server has commits in lower case that the client doesn\(cqt, as in the following diagram:
83 +\-\-\-\- u \-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\- x
86 a \-\- b \-\- c \-\- d \-\- E \-\- F
88 +\-\-\- Q \-\- R \-\- S
94 If the client wants x,y and starts out by saying have F,S, the server doesn\(cqt 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\(cqt send c\-b\-a), but it\(cqs 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\&.
96 Without multi_ack the client would have sent that c\-b\-a chain anyway, interleaved with S\-R\-Q\&.
97 .SH "MULTI_ACK_DETAILED"
99 This is an extension of multi_ack that permits client to better understand the server\(cqs in\-memory state\&. See \fBgitprotocol-pack\fR(5), section "Packfile Negotiation" for more information\&.
102 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\&.
104 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\&.
107 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\&.
109 The upload\-pack server advertises \fIthin\-pack\fR when it can generate and send a thin pack\&. A client requests the \fIthin\-pack\fR capability when it understands how to "thicken" it, notifying the server that it can receive such a pack\&. A client MUST NOT request the \fIthin\-pack\fR capability if it cannot turn a thin pack into a self\-contained pack\&.
111 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 \fIno\-thin\fR capability\&. A client MUST NOT send a thin pack if the server advertises the \fIno\-thin\fR capability\&.
113 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 \fIno\-thin\fR later allowed receive\-pack to disable the feature in a backwards\-compatible manner\&.
114 .SH "SIDE\-BAND, SIDE\-BAND\-64K"
116 This capability means that server can send, and client understand multiplexed progress reports and error info interleaved with the packfile itself\&.
118 These two options are mutually exclusive\&. A modern client always favors \fIside\-band\-64k\fR\&.
120 Either mode indicates that the packfile data will be streamed broken up into packets of up to either 1000 bytes in the case of \fIside_band\fR, or 65520 bytes in the case of \fIside_band_64k\fR\&. 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\&.
122 The stream code can be one of:
129 2 \- progress messages
130 3 \- fatal error message just before stream aborts
136 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\&.
138 Further, with side\-band and its up to 1000\-byte messages, it\(cqs 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\&.
140 The client MUST send only maximum of one of "side\-band" and "side\- band\-64k"\&. Server MUST diagnose it as an error if client requests both\&.
143 Server can send, and client 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\&.
146 The server may optionally send a capability of the form \fBagent=X\fR to notify the client that the server is running version \fBX\fR\&. The client may optionally return its own agent string by responding with an \fBagent=Y\fR capability (but it MUST NOT do so if the server did not mention the agent capability)\&. The \fBX\fR and \fBY\fR 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\&.
149 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\&.
151 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\&.
153 If this capability is not provided, it is assumed that the only supported algorithm is SHA\-1\&.
156 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\&.
158 Servers SHOULD include this capability for the HEAD symref if it is one of the refs being sent\&.
160 Clients MAY use the parameters from this capability to select the proper initial branch when cloning a repository\&.
163 This capability adds "deepen", "shallow" and "unshallow" commands to the fetch\-pack/upload\-pack protocol so clients can request shallow clones\&.
166 This capability adds "deepen\-since" command to fetch\-pack/upload\-pack protocol so the client can request shallow clones that are cut at a specific time, instead of depth\&. Internally it\(cqs equivalent of doing "rev\-list \-\-max\-age=<timestamp>" on the server side\&. "deepen\-since" cannot be used with "deepen"\&.
169 This capability adds "deepen\-not" command to fetch\-pack/upload\-pack protocol so the client can request shallow clones that are cut at a specific revision, instead of depth\&. Internally it\(cqs equivalent of doing "rev\-list \-\-not <rev>" on the server side\&. "deepen\-not" cannot be used with "deepen", but can be used with "deepen\-since"\&.
170 .SH "DEEPEN\-RELATIVE"
172 If this capability is requested by the client, the semantics of "deepen" command is changed\&. The "depth" argument is the depth from the current shallow boundary, instead of the depth from remote refs\&.
175 The client was started with "git clone \-q" or something, and doesn\(cqt want that side band 2\&. Basically the client just says "I do not wish to receive stream 2 on sideband, so do not send it to me, and if you did, I will drop it on the floor anyway"\&. However, the sideband channel 3 is still used for error responses\&.
178 The \fIinclude\-tag\fR capability is about sending annotated tags if we are sending objects they point to\&. If we pack an object to the client, and a tag object points exactly at that object, we pack the tag object too\&. In general this allows a client to get all new annotated tags when it fetches a branch, in a single network connection\&.
180 Clients MAY always send include\-tag, hardcoding it into a request when the server advertises this capability\&. The decision for a client to request include\-tag only has to do with the client\(cqs desires for tag data, whether or not a server had advertised objects in the refs/tags/* namespace\&.
182 Servers MUST pack the tags if their referrant is packed and the client has requested include\-tags\&.
184 Clients MUST be prepared for the case where a server has ignored include\-tag and has not actually sent tags in the pack\&. In such cases the client SHOULD issue a subsequent fetch to acquire the tags that include\-tag would have otherwise given the client\&.
186 The server SHOULD send include\-tag, if it supports it, regardless of whether or not there are tags available\&.
189 The receive\-pack process can receive a \fIreport\-status\fR capability, which tells it that the client wants a report of what happened after a packfile upload and reference update\&. If the pushing client requests this capability, after unpacking and updating references the server will respond with whether the packfile unpacked successfully and if each reference was updated successfully\&. If any of those were not successful, it will send back an error message\&. See \fBgitprotocol-pack\fR(5) for example messages\&.
190 .SH "REPORT\-STATUS\-V2"
192 Capability \fIreport\-status\-v2\fR extends capability \fIreport\-status\fR by adding new "option" directives in order to support reference rewritten by the "proc\-receive" hook\&. The "proc\-receive" hook may handle a command for a pseudo\-reference which may create or update a reference with different name, new\-oid, and old\-oid\&. While the capability \fIreport\-status\fR cannot report for such case\&. See \fBgitprotocol-pack\fR(5) for details\&.
195 If the server sends back the \fIdelete\-refs\fR capability, it means that it is capable of accepting a zero\-id value as the target value of a reference update\&. It is not sent back by the client, it simply informs the client that it can be sent zero\-id values to delete references\&.
198 If the receive\-pack server advertises the \fIquiet\fR capability, it is capable of silencing human\-readable progress output which otherwise may be shown when processing the received pack\&. A send\-pack client should respond with the \fIquiet\fR capability to suppress server\-side progress reporting if the local progress reporting is also being suppressed (e\&.g\&., via \fBpush \-q\fR, or if stderr does not go to a tty)\&.
201 If the server sends the \fIatomic\fR capability it is capable of accepting atomic pushes\&. If the pushing client requests this capability, the server will update the refs in one atomic transaction\&. Either all refs are updated or none\&.
204 If the server sends the \fIpush\-options\fR capability it is able to accept push options after the update commands have been sent, but before the packfile is streamed\&. If the pushing client requests this capability, the server will pass the options to the pre\- and post\- receive hooks that process this push request\&.
205 .SH "ALLOW\-TIP\-SHA1\-IN\-WANT"
207 If the upload\-pack server advertises this capability, fetch\-pack may send "want" lines with object names that exist at the server but are not advertised by upload\-pack\&. For historical reasons, the name of this capability contains "sha1"\&. Object names are always given using the object format negotiated through the \fIobject\-format\fR capability\&.
208 .SH "ALLOW\-REACHABLE\-SHA1\-IN\-WANT"
210 If the upload\-pack server advertises this capability, fetch\-pack may send "want" lines with object names that exist at the server but are not advertised by upload\-pack\&. For historical reasons, the name of this capability contains "sha1"\&. Object names are always given using the object format negotiated through the \fIobject\-format\fR capability\&.
211 .SH "PUSH\-CERT=<NONCE>"
213 The receive\-pack server that advertises this capability is willing to accept a signed push certificate, and asks the <nonce> to be included in the push certificate\&. A send\-pack client MUST NOT send a push\-cert packet unless the receive\-pack server advertises this capability\&.
216 If the upload\-pack server advertises the \fIfilter\fR capability, fetch\-pack may send "filter" commands to request a partial clone or partial fetch and request that the server omit various objects from the packfile\&.
217 .SH "SESSION\-ID=<SESSION ID>"
219 The server may advertise a session ID that can be used to identify this process across multiple requests\&. The client may advertise its own session ID back to the server as well\&.
221 Session IDs should be unique to a given process\&. They must fit within a packet\-line, and must not contain non\-printable or whitespace characters\&. The current implementation uses trace2 session IDs (see \m[blue]\fBapi\-trace2\fR\m[]\&\s-2\u[1]\d\s+2 for details), but this may change and users of the session ID should not rely on this fact\&.
224 Part of the \fBgit\fR(1) suite
229 \%git-htmldocs/technical/api-trace2.html