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