1GITPROTOCOL-CAPABILITIES(5) Git Manual GITPROTOCOL-CAPABILITIES(5)
2
3
4
6 gitprotocol-capabilities - Protocol v0 and v1 capabilities
7
9 <over-the-wire-protocol>
10
12 Note
13 this document describes capabilities for versions 0 and 1 of the
14 pack protocol. For version 2, please refer to the gitprotocol-v2(5)
15 doc.
16
17 Servers SHOULD support all capabilities defined in this document.
18
19 On the very first line of the initial server response of either
20 receive-pack and upload-pack the first reference is followed by a NUL
21 byte and then a list of space delimited server capabilities. These
22 allow the server to declare what it can and cannot support to the
23 client.
24
25 Client will then send a space separated list of capabilities it wants
26 to be in effect. The client MUST NOT ask for capabilities the server
27 did not say it supports.
28
29 Server MUST diagnose and abort if capabilities it does not understand
30 were sent. Server MUST NOT ignore capabilities that client requested
31 and server advertised. As a consequence of these rules, server MUST NOT
32 advertise capabilities it does not understand.
33
34 The atomic, report-status, report-status-v2, delete-refs, quiet, and
35 push-cert capabilities are sent and recognized by the receive-pack
36 (push to server) process.
37
38 The ofs-delta and side-band-64k capabilities are sent and recognized by
39 both upload-pack and receive-pack protocols. The agent and session-id
40 capabilities may optionally be sent in both protocols.
41
42 All other capabilities are only recognized by the upload-pack (fetch
43 from server) process.
44
46 The multi_ack capability allows the server to return "ACK obj-id
47 continue" as soon as it finds a commit that it can use as a common
48 base, between the client’s wants and the client’s have set.
49
50 By sending this early, the server can potentially head off the client
51 from walking any further down that particular branch of the client’s
52 repository history. The client may still need to walk down other
53 branches, sending have lines for those, until the server has a complete
54 cut across the DAG, or the client has said "done".
55
56 Without multi_ack, a client sends have lines in --date-order until the
57 server has found a common base. That means the client will send have
58 lines that are already known by the server to be common, because they
59 overlap in time with another branch on which the server hasn’t found a
60 common base yet.
61
62 For example suppose the client has commits in caps that the server
63 doesn’t and the server has commits in lower case that the client
64 doesn’t, as in the following diagram:
65
66 +---- u ---------------------- x
67 / +----- y
68 / /
69 a -- b -- c -- d -- E -- F
70 \
71 +--- Q -- R -- S
72
73 If the client wants x,y and starts out by saying have F,S, the server
74 doesn’t know what F,S is. Eventually the client says "have d" and the
75 server sends "ACK d continue" to let the client know to stop walking
76 down that line (so don’t send c-b-a), but it’s not done yet, it needs a
77 base for x. The client keeps going with S-R-Q, until a gets reached, at
78 which point the server has a clear base and it all ends.
79
80 Without multi_ack the client would have sent that c-b-a chain anyway,
81 interleaved with S-R-Q.
82
84 This is an extension of multi_ack that permits the client to better
85 understand the server’s in-memory state. See gitprotocol-pack(5),
86 section "Packfile Negotiation" for more information.
87
89 This capability should only be used with the smart HTTP protocol. If
90 multi_ack_detailed and no-done are both present, then the sender is
91 free to immediately send a pack following its first "ACK obj-id ready"
92 message.
93
94 Without no-done in the smart HTTP protocol, the server session would
95 end and the client has to make another trip to send "done" before the
96 server can send the pack. no-done removes the last round and thus
97 slightly reduces latency.
98
100 A thin pack is one with deltas which reference base objects not
101 contained within the pack (but are known to exist at the receiving
102 end). This can reduce the network traffic significantly, but it
103 requires the receiving end to know how to "thicken" these packs by
104 adding the missing bases to the pack.
105
106 The upload-pack server advertises thin-pack when it can generate and
107 send a thin pack. A client requests the thin-pack capability when it
108 understands how to "thicken" it, notifying the server that it can
109 receive such a pack. A client MUST NOT request the thin-pack capability
110 if it cannot turn a thin pack into a self-contained pack.
111
112 Receive-pack, on the other hand, is assumed by default to be able to
113 handle thin packs, but can ask the client not to use the feature by
114 advertising the no-thin capability. A client MUST NOT send a thin pack
115 if the server advertises the no-thin capability.
116
117 The reasons for this asymmetry are historical. The receive-pack program
118 did not exist until after the invention of thin packs, so historically
119 the reference implementation of receive-pack always understood thin
120 packs. Adding no-thin later allowed receive-pack to disable the feature
121 in a backwards-compatible manner.
122
124 This capability means that the server can send, and the client can
125 understand, multiplexed progress reports and error info interleaved
126 with the packfile itself.
127
128 These two options are mutually exclusive. A modern client always favors
129 side-band-64k.
130
131 Either mode indicates that the packfile data will be streamed broken up
132 into packets of up to either 1000 bytes in the case of side_band, or
133 65520 bytes in the case of side_band_64k. Each packet is made up of a
134 leading 4-byte pkt-line length of how much data is in the packet,
135 followed by a 1-byte stream code, followed by the actual data.
136
137 The stream code can be one of:
138
139 1 - pack data
140 2 - progress messages
141 3 - fatal error message just before stream aborts
142
143 The "side-band-64k" capability came about as a way for newer clients
144 that can handle much larger packets to request packets that are
145 actually crammed nearly full, while maintaining backward compatibility
146 for the older clients.
147
148 Further, with side-band and its up to 1000-byte messages, it’s actually
149 999 bytes of payload and 1 byte for the stream code. With
150 side-band-64k, same deal, you have up to 65519 bytes of data and 1 byte
151 for the stream code.
152
153 The client MUST send only one of "side-band" and "side- band-64k". The
154 server MUST diagnose it as an error if client requests both.
155
157 The server can send, and the client can understand, PACKv2 with delta
158 referring to its base by position in pack rather than by an obj-id.
159 That is, they can send/read OBJ_OFS_DELTA (aka type 6) in a packfile.
160
162 The server may optionally send a capability of the form agent=X to
163 notify the client that the server is running version X. The client may
164 optionally return its own agent string by responding with an agent=Y
165 capability (but it MUST NOT do so if the server did not mention the
166 agent capability). The X and Y strings may contain any printable ASCII
167 characters except space (i.e., the byte range 32 < x < 127), and are
168 typically of the form "package/version" (e.g., "git/1.8.3.1"). The
169 agent strings are purely informative for statistics and debugging
170 purposes, and MUST NOT be used to programmatically assume the presence
171 or absence of particular features.
172
174 This capability, which takes a hash algorithm as an argument, indicates
175 that the server supports the given hash algorithms. It may be sent
176 multiple times; if so, the first one given is the one used in the ref
177 advertisement.
178
179 When provided by the client, this indicates that it intends to use the
180 given hash algorithm to communicate. The algorithm provided must be one
181 that the server supports.
182
183 If this capability is not provided, it is assumed that the only
184 supported algorithm is SHA-1.
185
187 This parameterized capability is used to inform the receiver which
188 symbolic ref points to which ref; for example,
189 "symref=HEAD:refs/heads/master" tells the receiver that HEAD points to
190 master. This capability can be repeated to represent multiple symrefs.
191
192 Servers SHOULD include this capability for the HEAD symref if it is one
193 of the refs being sent.
194
195 Clients MAY use the parameters from this capability to select the
196 proper initial branch when cloning a repository.
197
199 This capability adds "deepen", "shallow" and "unshallow" commands to
200 the fetch-pack/upload-pack protocol so clients can request shallow
201 clones.
202
204 This capability adds "deepen-since" command to fetch-pack/upload-pack
205 protocol so the client can request shallow clones that are cut at a
206 specific time, instead of depth. Internally it’s equivalent of doing
207 "rev-list --max-age=<timestamp>" on the server side. "deepen-since"
208 cannot be used with "deepen".
209
211 This capability adds "deepen-not" command to fetch-pack/upload-pack
212 protocol so the client can request shallow clones that are cut at a
213 specific revision, instead of depth. Internally it’s equivalent of
214 doing "rev-list --not <rev>" on the server side. "deepen-not" cannot be
215 used with "deepen", but can be used with "deepen-since".
216
218 If this capability is requested by the client, the semantics of
219 "deepen" command is changed. The "depth" argument is the depth from the
220 current shallow boundary, instead of the depth from remote refs.
221
223 The client was started with "git clone -q" or something similar, and
224 doesn’t want that side band 2. Basically the client just says "I do not
225 wish to receive stream 2 on sideband, so do not send it to me, and if
226 you did, I will drop it on the floor anyway". However, the sideband
227 channel 3 is still used for error responses.
228
230 The include-tag capability is about sending annotated tags if we are
231 sending objects they point to. If we pack an object to the client, and
232 a tag object points exactly at that object, we pack the tag object too.
233 In general this allows a client to get all new annotated tags when it
234 fetches a branch, in a single network connection.
235
236 Clients MAY always send include-tag, hardcoding it into a request when
237 the server advertises this capability. The decision for a client to
238 request include-tag only has to do with the client’s desires for tag
239 data, whether or not a server had advertised objects in the refs/tags/*
240 namespace.
241
242 Servers MUST pack the tags if their referent is packed and the client
243 has requested include-tags.
244
245 Clients MUST be prepared for the case where a server has ignored
246 include-tag and has not actually sent tags in the pack. In such cases
247 the client SHOULD issue a subsequent fetch to acquire the tags that
248 include-tag would have otherwise given the client.
249
250 The server SHOULD send include-tag, if it supports it, regardless of
251 whether or not there are tags available.
252
254 The receive-pack process can receive a report-status capability, which
255 tells it that the client wants a report of what happened after a
256 packfile upload and reference update. If the pushing client requests
257 this capability, after unpacking and updating references the server
258 will respond with whether the packfile unpacked successfully and if
259 each reference was updated successfully. If any of those were not
260 successful, it will send back an error message. See gitprotocol-pack(5)
261 for example messages.
262
264 Capability report-status-v2 extends capability report-status by adding
265 new "option" directives in order to support reference rewritten by the
266 "proc-receive" hook. The "proc-receive" hook may handle a command for a
267 pseudo-reference which may create or update a reference with different
268 name, new-oid, and old-oid. While the capability report-status cannot
269 report for such case. See gitprotocol-pack(5) for details.
270
272 If the server sends back the delete-refs capability, it means that it
273 is capable of accepting a zero-id value as the target value of a
274 reference update. It is not sent back by the client, it simply informs
275 the client that it can be sent zero-id values to delete references.
276
278 If the receive-pack server advertises the quiet capability, it is
279 capable of silencing human-readable progress output which otherwise may
280 be shown when processing the received pack. A send-pack client should
281 respond with the quiet capability to suppress server-side progress
282 reporting if the local progress reporting is also being suppressed
283 (e.g., via push -q, or if stderr does not go to a tty).
284
286 If the server sends the atomic capability it is capable of accepting
287 atomic pushes. If the pushing client requests this capability, the
288 server will update the refs in one atomic transaction. Either all refs
289 are updated or none.
290
292 If the server sends the push-options capability it is able to accept
293 push options after the update commands have been sent, but before the
294 packfile is streamed. If the pushing client requests this capability,
295 the server will pass the options to the pre- and post- receive hooks
296 that process this push request.
297
299 If the upload-pack server advertises this capability, fetch-pack may
300 send "want" lines with object names that exist at the server but are
301 not advertised by upload-pack. For historical reasons, the name of this
302 capability contains "sha1". Object names are always given using the
303 object format negotiated through the object-format capability.
304
306 If the upload-pack server advertises this capability, fetch-pack may
307 send "want" lines with object names that exist at the server but are
308 not advertised by upload-pack. For historical reasons, the name of this
309 capability contains "sha1". Object names are always given using the
310 object format negotiated through the object-format capability.
311
313 The receive-pack server that advertises this capability is willing to
314 accept a signed push certificate, and asks the <nonce> to be included
315 in the push certificate. A send-pack client MUST NOT send a push-cert
316 packet unless the receive-pack server advertises this capability.
317
319 If the upload-pack server advertises the filter capability, fetch-pack
320 may send "filter" commands to request a partial clone or partial fetch
321 and request that the server omit various objects from the packfile.
322
324 The server may advertise a session ID that can be used to identify this
325 process across multiple requests. The client may advertise its own
326 session ID back to the server as well.
327
328 Session IDs should be unique to a given process. They must fit within a
329 packet-line, and must not contain non-printable or whitespace
330 characters. The current implementation uses trace2 session IDs (see
331 api-trace2[1] for details), but this may change and users of the
332 session ID should not rely on this fact.
333
335 Part of the git(1) suite
336
338 1. api-trace2
339 file:///usr/share/doc/git/technical/api-trace2.html
340
341
342
343Git 2.43.0 11/20/2023 GITPROTOCOL-CAPABILITIES(5)