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