logo

oasis-root

Compiled tree of Oasis Linux based on own branch at <https://hacktivis.me/git/oasis/> git clone https://anongit.hacktivis.me/git/oasis-root.git

gitprotocol-v2.5 (41720B)


  1. '\" t
  2. .\" Title: gitprotocol-v2
  3. .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author]
  4. .\" Generator: DocBook XSL Stylesheets v1.79.2 <http://docbook.sf.net/>
  5. .\" Date: 2025-03-14
  6. .\" Manual: Git Manual
  7. .\" Source: Git 2.49.0
  8. .\" Language: English
  9. .\"
  10. .TH "GITPROTOCOL\-V2" "5" "2025-03-14" "Git 2\&.49\&.0" "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. .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  18. .ie \n(.g .ds Aq \(aq
  19. .el .ds Aq '
  20. .\" -----------------------------------------------------------------
  21. .\" * set default formatting
  22. .\" -----------------------------------------------------------------
  23. .\" disable hyphenation
  24. .nh
  25. .\" disable justification (adjust text to left margin only)
  26. .ad l
  27. .\" -----------------------------------------------------------------
  28. .\" * MAIN CONTENT STARTS HERE *
  29. .\" -----------------------------------------------------------------
  30. .SH "NAME"
  31. gitprotocol-v2 \- Git Wire Protocol, Version 2
  32. .SH "SYNOPSIS"
  33. .sp
  34. .nf
  35. <over\-the\-wire\-protocol>
  36. .fi
  37. .SH "DESCRIPTION"
  38. .sp
  39. This document presents a specification for a version 2 of Git\(cqs wire protocol\&. Protocol v2 will improve upon v1 in the following ways:
  40. .sp
  41. .RS 4
  42. .ie n \{\
  43. \h'-04'\(bu\h'+03'\c
  44. .\}
  45. .el \{\
  46. .sp -1
  47. .IP \(bu 2.3
  48. .\}
  49. Instead of multiple service names, multiple commands will be supported by a single service
  50. .RE
  51. .sp
  52. .RS 4
  53. .ie n \{\
  54. \h'-04'\(bu\h'+03'\c
  55. .\}
  56. .el \{\
  57. .sp -1
  58. .IP \(bu 2.3
  59. .\}
  60. Easily extendable as capabilities are moved into their own section of the protocol, no longer being hidden behind a NUL byte and limited by the size of a pkt\-line
  61. .RE
  62. .sp
  63. .RS 4
  64. .ie n \{\
  65. \h'-04'\(bu\h'+03'\c
  66. .\}
  67. .el \{\
  68. .sp -1
  69. .IP \(bu 2.3
  70. .\}
  71. Separate out other information hidden behind NUL bytes (e\&.g\&. agent string as a capability and symrefs can be requested using
  72. \fIls\-refs\fR)
  73. .RE
  74. .sp
  75. .RS 4
  76. .ie n \{\
  77. \h'-04'\(bu\h'+03'\c
  78. .\}
  79. .el \{\
  80. .sp -1
  81. .IP \(bu 2.3
  82. .\}
  83. Reference advertisement will be omitted unless explicitly requested
  84. .RE
  85. .sp
  86. .RS 4
  87. .ie n \{\
  88. \h'-04'\(bu\h'+03'\c
  89. .\}
  90. .el \{\
  91. .sp -1
  92. .IP \(bu 2.3
  93. .\}
  94. ls\-refs command to explicitly request some refs
  95. .RE
  96. .sp
  97. .RS 4
  98. .ie n \{\
  99. \h'-04'\(bu\h'+03'\c
  100. .\}
  101. .el \{\
  102. .sp -1
  103. .IP \(bu 2.3
  104. .\}
  105. Designed with http and stateless\-rpc in mind\&. With clear flush semantics the http remote helper can simply act as a proxy
  106. .RE
  107. .sp
  108. In protocol v2 communication is command oriented\&. When first contacting a server a list of capabilities will be advertised\&. Some of these capabilities will be commands which a client can request be executed\&. Once a command has completed, a client can reuse the connection and request that other commands be executed\&.
  109. .SH "PACKET\-LINE FRAMING"
  110. .sp
  111. All communication is done using packet\-line framing, just as in v1\&. See \fBgitprotocol-pack\fR(5) and \fBgitprotocol-common\fR(5) for more information\&.
  112. .sp
  113. In protocol v2 these special packets will have the following semantics:
  114. .sp
  115. .RS 4
  116. .ie n \{\
  117. \h'-04'\(bu\h'+03'\c
  118. .\}
  119. .el \{\
  120. .sp -1
  121. .IP \(bu 2.3
  122. .\}
  123. \fI0000\fR
  124. Flush Packet (flush\-pkt) \- indicates the end of a message
  125. .RE
  126. .sp
  127. .RS 4
  128. .ie n \{\
  129. \h'-04'\(bu\h'+03'\c
  130. .\}
  131. .el \{\
  132. .sp -1
  133. .IP \(bu 2.3
  134. .\}
  135. \fI0001\fR
  136. Delimiter Packet (delim\-pkt) \- separates sections of a message
  137. .RE
  138. .sp
  139. .RS 4
  140. .ie n \{\
  141. \h'-04'\(bu\h'+03'\c
  142. .\}
  143. .el \{\
  144. .sp -1
  145. .IP \(bu 2.3
  146. .\}
  147. \fI0002\fR
  148. Response End Packet (response\-end\-pkt) \- indicates the end of a response for stateless connections
  149. .RE
  150. .SH "INITIAL CLIENT REQUEST"
  151. .sp
  152. In general a client can request to speak protocol v2 by sending \fBversion=2\fR through the respective side\-channel for the transport being used which inevitably sets \fBGIT_PROTOCOL\fR\&. More information can be found in \fBgitprotocol-pack\fR(5) and \fBgitprotocol-http\fR(5), as well as the \fBGIT_PROTOCOL\fR definition in \fBgit\&.txt\fR\&. In all cases the response from the server is the capability advertisement\&.
  153. .SS "Git Transport"
  154. .sp
  155. When using the git:// transport, you can request to use protocol v2 by sending "version=2" as an extra parameter:
  156. .sp
  157. .if n \{\
  158. .RS 4
  159. .\}
  160. .nf
  161. 003egit\-upload\-pack /project\&.git\e0host=myserver\&.com\e0\e0version=2\e0
  162. .fi
  163. .if n \{\
  164. .RE
  165. .\}
  166. .SS "SSH and File Transport"
  167. .sp
  168. When using either the ssh:// or file:// transport, the GIT_PROTOCOL environment variable must be set explicitly to include "version=2"\&. The server may need to be configured to allow this environment variable to pass\&.
  169. .SS "HTTP Transport"
  170. .sp
  171. When using the http:// or https:// transport a client makes a "smart" info/refs request as described in \fBgitprotocol-http\fR(5) and requests that v2 be used by supplying "version=2" in the \fBGit\-Protocol\fR header\&.
  172. .sp
  173. .if n \{\
  174. .RS 4
  175. .\}
  176. .nf
  177. C: GET $GIT_URL/info/refs?service=git\-upload\-pack HTTP/1\&.0
  178. C: Git\-Protocol: version=2
  179. .fi
  180. .if n \{\
  181. .RE
  182. .\}
  183. .sp
  184. A v2 server would reply:
  185. .sp
  186. .if n \{\
  187. .RS 4
  188. .\}
  189. .nf
  190. S: 200 OK
  191. S: <Some headers>
  192. S: \&.\&.\&.
  193. S:
  194. S: 000eversion 2\en
  195. S: <capability\-advertisement>
  196. .fi
  197. .if n \{\
  198. .RE
  199. .\}
  200. .sp
  201. Subsequent requests are then made directly to the service \fB$GIT_URL/git\-upload\-pack\fR\&. (This works the same for git\-receive\-pack)\&.
  202. .sp
  203. Uses the \fB\-\-http\-backend\-info\-refs\fR option to \fBgit-upload-pack\fR(1)\&.
  204. .sp
  205. The server may need to be configured to pass this header\(cqs contents via the \fBGIT_PROTOCOL\fR variable\&. See the discussion in \fBgit\-http\-backend\&.txt\fR\&.
  206. .SH "CAPABILITY ADVERTISEMENT"
  207. .sp
  208. A server which decides to communicate (based on a request from a client) using protocol version 2, notifies the client by sending a version string in its initial response followed by an advertisement of its capabilities\&. Each capability is a key with an optional value\&. Clients must ignore all unknown keys\&. Semantics of unknown values are left to the definition of each key\&. Some capabilities will describe commands which can be requested to be executed by the client\&.
  209. .sp
  210. .if n \{\
  211. .RS 4
  212. .\}
  213. .nf
  214. capability\-advertisement = protocol\-version
  215. capability\-list
  216. flush\-pkt
  217. .fi
  218. .if n \{\
  219. .RE
  220. .\}
  221. .sp
  222. .if n \{\
  223. .RS 4
  224. .\}
  225. .nf
  226. protocol\-version = PKT\-LINE("version 2" LF)
  227. capability\-list = *capability
  228. capability = PKT\-LINE(key[=value] LF)
  229. .fi
  230. .if n \{\
  231. .RE
  232. .\}
  233. .sp
  234. .if n \{\
  235. .RS 4
  236. .\}
  237. .nf
  238. key = 1*(ALPHA | DIGIT | "\-_")
  239. value = 1*(ALPHA | DIGIT | " \-_\&.,?\e/{}[]()<>!@#$%^&*+=:;")
  240. .fi
  241. .if n \{\
  242. .RE
  243. .\}
  244. .SH "COMMAND REQUEST"
  245. .sp
  246. After receiving the capability advertisement, a client can then issue a request to select the command it wants with any particular capabilities or arguments\&. There is then an optional section where the client can provide any command specific parameters or queries\&. Only a single command can be requested at a time\&.
  247. .sp
  248. .if n \{\
  249. .RS 4
  250. .\}
  251. .nf
  252. request = empty\-request | command\-request
  253. empty\-request = flush\-pkt
  254. command\-request = command
  255. capability\-list
  256. delim\-pkt
  257. command\-args
  258. flush\-pkt
  259. command = PKT\-LINE("command=" key LF)
  260. command\-args = *command\-specific\-arg
  261. .fi
  262. .if n \{\
  263. .RE
  264. .\}
  265. .sp
  266. .if n \{\
  267. .RS 4
  268. .\}
  269. .nf
  270. command\-specific\-args are packet line framed arguments defined by
  271. each individual command\&.
  272. .fi
  273. .if n \{\
  274. .RE
  275. .\}
  276. .sp
  277. The server will then check to ensure that the client\(cqs request is comprised of a valid command as well as valid capabilities which were advertised\&. If the request is valid the server will then execute the command\&. A server MUST wait till it has received the client\(cqs entire request before issuing a response\&. The format of the response is determined by the command being executed, but in all cases a flush\-pkt indicates the end of the response\&.
  278. .sp
  279. When a command has finished, and the client has received the entire response from the server, a client can either request that another command be executed or can terminate the connection\&. A client may optionally send an empty request consisting of just a flush\-pkt to indicate that no more requests will be made\&.
  280. .SH "CAPABILITIES"
  281. .sp
  282. There are two different types of capabilities: normal capabilities, which can be used to convey information or alter the behavior of a request, and commands, which are the core actions that a client wants to perform (fetch, push, etc)\&.
  283. .sp
  284. Protocol version 2 is stateless by default\&. This means that all commands must only last a single round and be stateless from the perspective of the server side, unless the client has requested a capability indicating that state should be maintained by the server\&. Clients MUST NOT require state management on the server side in order to function correctly\&. This permits simple round\-robin load\-balancing on the server side, without needing to worry about state management\&.
  285. .SS "agent"
  286. .sp
  287. The server can advertise the \fBagent\fR capability with a value \fBX\fR (in the form \fBagent=X\fR) to notify the client that the server is running version \fBX\fR\&. The client may optionally send its own agent string by including the \fBagent\fR capability with a value \fBY\fR (in the form \fBagent=Y\fR) in its request to the server (but it MUST NOT do so if the server did not advertise the agent capability)\&. The \fBX\fR and \fBY\fR strings may contain any printable ASCII characters except space (i\&.e\&., the byte range 33 \(la x \(la 126), and are typically of the form "package/version\-os" (e\&.g\&., "git/1\&.8\&.3\&.1\-Linux") where \fBos\fR is the operating system name (e\&.g\&., "Linux")\&. \fBX\fR and \fBY\fR can be configured using the GIT_USER_AGENT environment variable and it takes priority\&. The \fBos\fR is retrieved using the \fIsysname\fR field of the \fBuname\fR(\fB2\fR) system call or its equivalent\&. 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\&.
  288. .SS "ls\-refs"
  289. .sp
  290. \fBls\-refs\fR is the command used to request a reference advertisement in v2\&. Unlike the current reference advertisement, ls\-refs takes in arguments which can be used to limit the refs sent from the server\&.
  291. .sp
  292. Additional features not supported in the base command will be advertised as the value of the command in the capability advertisement in the form of a space separated list of features: "<command>=<feature\-1> <feature\-2>"
  293. .sp
  294. ls\-refs takes in the following arguments:
  295. .sp
  296. .if n \{\
  297. .RS 4
  298. .\}
  299. .nf
  300. symrefs
  301. In addition to the object pointed by it, show the underlying ref
  302. pointed by it when showing a symbolic ref\&.
  303. peel
  304. Show peeled tags\&.
  305. ref\-prefix <prefix>
  306. When specified, only references having a prefix matching one of
  307. the provided prefixes are displayed\&. Multiple instances may be
  308. given, in which case references matching any prefix will be
  309. shown\&. Note that this is purely for optimization; a server MAY
  310. show refs not matching the prefix if it chooses, and clients
  311. should filter the result themselves\&.
  312. .fi
  313. .if n \{\
  314. .RE
  315. .\}
  316. .sp
  317. If the \fIunborn\fR feature is advertised the following argument can be included in the client\(cqs request\&.
  318. .sp
  319. .if n \{\
  320. .RS 4
  321. .\}
  322. .nf
  323. unborn
  324. The server will send information about HEAD even if it is a symref
  325. pointing to an unborn branch in the form "unborn HEAD
  326. symref\-target:<target>"\&.
  327. .fi
  328. .if n \{\
  329. .RE
  330. .\}
  331. .sp
  332. The output of ls\-refs is as follows:
  333. .sp
  334. .if n \{\
  335. .RS 4
  336. .\}
  337. .nf
  338. output = *ref
  339. flush\-pkt
  340. obj\-id\-or\-unborn = (obj\-id | "unborn")
  341. ref = PKT\-LINE(obj\-id\-or\-unborn SP refname *(SP ref\-attribute) LF)
  342. ref\-attribute = (symref | peeled)
  343. symref = "symref\-target:" symref\-target
  344. peeled = "peeled:" obj\-id
  345. .fi
  346. .if n \{\
  347. .RE
  348. .\}
  349. .SS "fetch"
  350. .sp
  351. \fBfetch\fR is the command used to fetch a packfile in v2\&. It can be looked at as a modified version of the v1 fetch where the ref\-advertisement is stripped out (since the \fBls\-refs\fR command fills that role) and the message format is tweaked to eliminate redundancies and permit easy addition of future extensions\&.
  352. .sp
  353. Additional features not supported in the base command will be advertised as the value of the command in the capability advertisement in the form of a space separated list of features: "<command>=<feature\-1> <feature\-2>"
  354. .sp
  355. A \fBfetch\fR request can take the following arguments:
  356. .sp
  357. .if n \{\
  358. .RS 4
  359. .\}
  360. .nf
  361. want <oid>
  362. Indicates to the server an object which the client wants to
  363. retrieve\&. Wants can be anything and are not limited to
  364. advertised objects\&.
  365. .fi
  366. .if n \{\
  367. .RE
  368. .\}
  369. .sp
  370. .if n \{\
  371. .RS 4
  372. .\}
  373. .nf
  374. have <oid>
  375. Indicates to the server an object which the client has locally\&.
  376. This allows the server to make a packfile which only contains
  377. the objects that the client needs\&. Multiple \*(Aqhave\*(Aq lines can be
  378. supplied\&.
  379. .fi
  380. .if n \{\
  381. .RE
  382. .\}
  383. .sp
  384. .if n \{\
  385. .RS 4
  386. .\}
  387. .nf
  388. done
  389. Indicates to the server that negotiation should terminate (or
  390. not even begin if performing a clone) and that the server should
  391. use the information supplied in the request to construct the
  392. packfile\&.
  393. .fi
  394. .if n \{\
  395. .RE
  396. .\}
  397. .sp
  398. .if n \{\
  399. .RS 4
  400. .\}
  401. .nf
  402. thin\-pack
  403. Request that a thin pack be sent, which is a pack with deltas
  404. which reference base objects not contained within the pack (but
  405. are known to exist at the receiving end)\&. This can reduce the
  406. network traffic significantly, but it requires the receiving end
  407. to know how to "thicken" these packs by adding the missing bases
  408. to the pack\&.
  409. .fi
  410. .if n \{\
  411. .RE
  412. .\}
  413. .sp
  414. .if n \{\
  415. .RS 4
  416. .\}
  417. .nf
  418. no\-progress
  419. Request that progress information that would normally be sent on
  420. side\-band channel 2, during the packfile transfer, should not be
  421. sent\&. However, the side\-band channel 3 is still used for error
  422. responses\&.
  423. .fi
  424. .if n \{\
  425. .RE
  426. .\}
  427. .sp
  428. .if n \{\
  429. .RS 4
  430. .\}
  431. .nf
  432. include\-tag
  433. Request that annotated tags should be sent if the objects they
  434. point to are being sent\&.
  435. .fi
  436. .if n \{\
  437. .RE
  438. .\}
  439. .sp
  440. .if n \{\
  441. .RS 4
  442. .\}
  443. .nf
  444. ofs\-delta
  445. Indicate that the client understands PACKv2 with delta referring
  446. to its base by position in pack rather than by an oid\&. That is,
  447. they can read OBJ_OFS_DELTA (aka type 6) in a packfile\&.
  448. .fi
  449. .if n \{\
  450. .RE
  451. .\}
  452. .sp
  453. If the \fIshallow\fR feature is advertised the following arguments can be included in the clients request as well as the potential addition of the \fIshallow\-info\fR section in the server\(cqs response as explained below\&.
  454. .sp
  455. .if n \{\
  456. .RS 4
  457. .\}
  458. .nf
  459. shallow <oid>
  460. A client must notify the server of all commits for which it only
  461. has shallow copies (meaning that it doesn\*(Aqt have the parents of
  462. a commit) by supplying a \*(Aqshallow <oid>\*(Aq line for each such
  463. object so that the server is aware of the limitations of the
  464. client\*(Aqs history\&. This is so that the server is aware that the
  465. client may not have all objects reachable from such commits\&.
  466. .fi
  467. .if n \{\
  468. .RE
  469. .\}
  470. .sp
  471. .if n \{\
  472. .RS 4
  473. .\}
  474. .nf
  475. deepen <depth>
  476. Requests that the fetch/clone should be shallow having a commit
  477. depth of <depth> relative to the remote side\&.
  478. .fi
  479. .if n \{\
  480. .RE
  481. .\}
  482. .sp
  483. .if n \{\
  484. .RS 4
  485. .\}
  486. .nf
  487. deepen\-relative
  488. Requests that the semantics of the "deepen" command be changed
  489. to indicate that the depth requested is relative to the client\*(Aqs
  490. current shallow boundary, instead of relative to the requested
  491. commits\&.
  492. .fi
  493. .if n \{\
  494. .RE
  495. .\}
  496. .sp
  497. .if n \{\
  498. .RS 4
  499. .\}
  500. .nf
  501. deepen\-since <timestamp>
  502. Requests that the shallow clone/fetch should be cut at a
  503. specific time, instead of depth\&. Internally it\*(Aqs equivalent to
  504. doing "git rev\-list \-\-max\-age=<timestamp>"\&. Cannot be used with
  505. "deepen"\&.
  506. .fi
  507. .if n \{\
  508. .RE
  509. .\}
  510. .sp
  511. .if n \{\
  512. .RS 4
  513. .\}
  514. .nf
  515. deepen\-not <rev>
  516. Requests that the shallow clone/fetch should be cut at a
  517. specific revision specified by \*(Aq<rev>\*(Aq, instead of a depth\&.
  518. Internally it\*(Aqs equivalent of doing "git rev\-list \-\-not <rev>"\&.
  519. Cannot be used with "deepen", but can be used with
  520. "deepen\-since"\&.
  521. .fi
  522. .if n \{\
  523. .RE
  524. .\}
  525. .sp
  526. If the \fIfilter\fR feature is advertised, the following argument can be included in the client\(cqs request:
  527. .sp
  528. .if n \{\
  529. .RS 4
  530. .\}
  531. .nf
  532. filter <filter\-spec>
  533. Request that various objects from the packfile be omitted
  534. using one of several filtering techniques\&. These are intended
  535. for use with partial clone and partial fetch operations\&. See
  536. `rev\-list` for possible "filter\-spec" values\&. When communicating
  537. with other processes, senders SHOULD translate scaled integers
  538. (e\&.g\&. "1k") into a fully\-expanded form (e\&.g\&. "1024") to aid
  539. interoperability with older receivers that may not understand
  540. newly\-invented scaling suffixes\&. However, receivers SHOULD
  541. accept the following suffixes: \*(Aqk\*(Aq, \*(Aqm\*(Aq, and \*(Aqg\*(Aq for 1024,
  542. 1048576, and 1073741824, respectively\&.
  543. .fi
  544. .if n \{\
  545. .RE
  546. .\}
  547. .sp
  548. If the \fIref\-in\-want\fR feature is advertised, the following argument can be included in the client\(cqs request as well as the potential addition of the \fIwanted\-refs\fR section in the server\(cqs response as explained below\&.
  549. .sp
  550. .if n \{\
  551. .RS 4
  552. .\}
  553. .nf
  554. want\-ref <ref>
  555. Indicates to the server that the client wants to retrieve a
  556. particular ref, where <ref> is the full name of a ref on the
  557. server\&. It is a protocol error to send want\-ref for the
  558. same ref more than once\&.
  559. .fi
  560. .if n \{\
  561. .RE
  562. .\}
  563. .sp
  564. If the \fIsideband\-all\fR feature is advertised, the following argument can be included in the client\(cqs request:
  565. .sp
  566. .if n \{\
  567. .RS 4
  568. .\}
  569. .nf
  570. sideband\-all
  571. Instruct the server to send the whole response multiplexed, not just
  572. the packfile section\&. All non\-flush and non\-delim PKT\-LINE in the
  573. response (not only in the packfile section) will then start with a byte
  574. indicating its sideband (1, 2, or 3), and the server may send "0005\e2"
  575. (a PKT\-LINE of sideband 2 with no payload) as a keepalive packet\&.
  576. .fi
  577. .if n \{\
  578. .RE
  579. .\}
  580. .sp
  581. If the \fIpackfile\-uris\fR feature is advertised, the following argument can be included in the client\(cqs request as well as the potential addition of the \fIpackfile\-uris\fR section in the server\(cqs response as explained below\&. Note that at most one \fBpackfile\-uris\fR line can be sent to the server\&.
  582. .sp
  583. .if n \{\
  584. .RS 4
  585. .\}
  586. .nf
  587. packfile\-uris <comma\-separated\-list\-of\-protocols>
  588. Indicates to the server that the client is willing to receive
  589. URIs of any of the given protocols in place of objects in the
  590. sent packfile\&. Before performing the connectivity check, the
  591. client should download from all given URIs\&. Currently, the
  592. protocols supported are "http" and "https"\&.
  593. .fi
  594. .if n \{\
  595. .RE
  596. .\}
  597. .sp
  598. If the \fIwait\-for\-done\fR feature is advertised, the following argument can be included in the client\(cqs request\&.
  599. .sp
  600. .if n \{\
  601. .RS 4
  602. .\}
  603. .nf
  604. wait\-for\-done
  605. Indicates to the server that it should never send "ready", but
  606. should wait for the client to say "done" before sending the
  607. packfile\&.
  608. .fi
  609. .if n \{\
  610. .RE
  611. .\}
  612. .sp
  613. The response of \fBfetch\fR is broken into a number of sections separated by delimiter packets (0001), with each section beginning with its section header\&. Most sections are sent only when the packfile is sent\&.
  614. .sp
  615. .if n \{\
  616. .RS 4
  617. .\}
  618. .nf
  619. output = acknowledgements flush\-pkt |
  620. [acknowledgments delim\-pkt] [shallow\-info delim\-pkt]
  621. [wanted\-refs delim\-pkt] [packfile\-uris delim\-pkt]
  622. packfile flush\-pkt
  623. .fi
  624. .if n \{\
  625. .RE
  626. .\}
  627. .sp
  628. .if n \{\
  629. .RS 4
  630. .\}
  631. .nf
  632. acknowledgments = PKT\-LINE("acknowledgments" LF)
  633. (nak | *ack)
  634. (ready)
  635. ready = PKT\-LINE("ready" LF)
  636. nak = PKT\-LINE("NAK" LF)
  637. ack = PKT\-LINE("ACK" SP obj\-id LF)
  638. .fi
  639. .if n \{\
  640. .RE
  641. .\}
  642. .sp
  643. .if n \{\
  644. .RS 4
  645. .\}
  646. .nf
  647. shallow\-info = PKT\-LINE("shallow\-info" LF)
  648. *PKT\-LINE((shallow | unshallow) LF)
  649. shallow = "shallow" SP obj\-id
  650. unshallow = "unshallow" SP obj\-id
  651. .fi
  652. .if n \{\
  653. .RE
  654. .\}
  655. .sp
  656. .if n \{\
  657. .RS 4
  658. .\}
  659. .nf
  660. wanted\-refs = PKT\-LINE("wanted\-refs" LF)
  661. *PKT\-LINE(wanted\-ref LF)
  662. wanted\-ref = obj\-id SP refname
  663. .fi
  664. .if n \{\
  665. .RE
  666. .\}
  667. .sp
  668. .if n \{\
  669. .RS 4
  670. .\}
  671. .nf
  672. packfile\-uris = PKT\-LINE("packfile\-uris" LF) *packfile\-uri
  673. packfile\-uri = PKT\-LINE(40*(HEXDIGIT) SP *%x20\-ff LF)
  674. .fi
  675. .if n \{\
  676. .RE
  677. .\}
  678. .sp
  679. .if n \{\
  680. .RS 4
  681. .\}
  682. .nf
  683. packfile = PKT\-LINE("packfile" LF)
  684. *PKT\-LINE(%x01\-03 *%x00\-ff)
  685. .fi
  686. .if n \{\
  687. .RE
  688. .\}
  689. .sp
  690. .if n \{\
  691. .RS 4
  692. .\}
  693. .nf
  694. acknowledgments section
  695. * If the client determines that it is finished with negotiations by
  696. sending a "done" line (thus requiring the server to send a packfile),
  697. the acknowledgments sections MUST be omitted from the server\*(Aqs
  698. response\&.
  699. .fi
  700. .if n \{\
  701. .RE
  702. .\}
  703. .sp
  704. .RS 4
  705. .ie n \{\
  706. \h'-04'\(bu\h'+03'\c
  707. .\}
  708. .el \{\
  709. .sp -1
  710. .IP \(bu 2.3
  711. .\}
  712. Always begins with the section header "acknowledgments"
  713. .RE
  714. .sp
  715. .RS 4
  716. .ie n \{\
  717. \h'-04'\(bu\h'+03'\c
  718. .\}
  719. .el \{\
  720. .sp -1
  721. .IP \(bu 2.3
  722. .\}
  723. The server will respond with "NAK" if none of the object ids sent as have lines were common\&.
  724. .RE
  725. .sp
  726. .RS 4
  727. .ie n \{\
  728. \h'-04'\(bu\h'+03'\c
  729. .\}
  730. .el \{\
  731. .sp -1
  732. .IP \(bu 2.3
  733. .\}
  734. The server will respond with "ACK obj\-id" for all of the object ids sent as have lines which are common\&.
  735. .RE
  736. .sp
  737. .RS 4
  738. .ie n \{\
  739. \h'-04'\(bu\h'+03'\c
  740. .\}
  741. .el \{\
  742. .sp -1
  743. .IP \(bu 2.3
  744. .\}
  745. A response cannot have both "ACK" lines as well as a "NAK" line\&.
  746. .RE
  747. .sp
  748. .RS 4
  749. .ie n \{\
  750. \h'-04'\(bu\h'+03'\c
  751. .\}
  752. .el \{\
  753. .sp -1
  754. .IP \(bu 2.3
  755. .\}
  756. The server will respond with a "ready" line indicating that the server has found an acceptable common base and is ready to make and send a packfile (which will be found in the packfile section of the same response)
  757. .RE
  758. .sp
  759. .RS 4
  760. .ie n \{\
  761. \h'-04'\(bu\h'+03'\c
  762. .\}
  763. .el \{\
  764. .sp -1
  765. .IP \(bu 2.3
  766. .\}
  767. If the server has found a suitable cut point and has decided to send a "ready" line, then the server can decide to (as an optimization) omit any "ACK" lines it would have sent during its response\&. This is because the server will have already determined the objects it plans to send to the client and no further negotiation is needed\&.
  768. .sp
  769. .if n \{\
  770. .RS 4
  771. .\}
  772. .nf
  773. shallow\-info section
  774. * If the client has requested a shallow fetch/clone, a shallow
  775. client requests a fetch or the server is shallow then the
  776. server\*(Aqs response may include a shallow\-info section\&. The
  777. shallow\-info section will be included if (due to one of the
  778. above conditions) the server needs to inform the client of any
  779. shallow boundaries or adjustments to the clients already
  780. existing shallow boundaries\&.
  781. .fi
  782. .if n \{\
  783. .RE
  784. .\}
  785. .RE
  786. .sp
  787. .RS 4
  788. .ie n \{\
  789. \h'-04'\(bu\h'+03'\c
  790. .\}
  791. .el \{\
  792. .sp -1
  793. .IP \(bu 2.3
  794. .\}
  795. Always begins with the section header "shallow\-info"
  796. .RE
  797. .sp
  798. .RS 4
  799. .ie n \{\
  800. \h'-04'\(bu\h'+03'\c
  801. .\}
  802. .el \{\
  803. .sp -1
  804. .IP \(bu 2.3
  805. .\}
  806. If a positive depth is requested, the server will compute the set of commits which are no deeper than the desired depth\&.
  807. .RE
  808. .sp
  809. .RS 4
  810. .ie n \{\
  811. \h'-04'\(bu\h'+03'\c
  812. .\}
  813. .el \{\
  814. .sp -1
  815. .IP \(bu 2.3
  816. .\}
  817. The server sends a "shallow obj\-id" line for each commit whose parents will not be sent in the following packfile\&.
  818. .RE
  819. .sp
  820. .RS 4
  821. .ie n \{\
  822. \h'-04'\(bu\h'+03'\c
  823. .\}
  824. .el \{\
  825. .sp -1
  826. .IP \(bu 2.3
  827. .\}
  828. The server sends an "unshallow obj\-id" line for each commit which the client has indicated is shallow, but is no longer shallow as a result of the fetch (due to its parents being sent in the following packfile)\&.
  829. .RE
  830. .sp
  831. .RS 4
  832. .ie n \{\
  833. \h'-04'\(bu\h'+03'\c
  834. .\}
  835. .el \{\
  836. .sp -1
  837. .IP \(bu 2.3
  838. .\}
  839. The server MUST NOT send any "unshallow" lines for anything which the client has not indicated was shallow as a part of its request\&.
  840. .sp
  841. .if n \{\
  842. .RS 4
  843. .\}
  844. .nf
  845. wanted\-refs section
  846. * This section is only included if the client has requested a
  847. ref using a \*(Aqwant\-ref\*(Aq line and if a packfile section is also
  848. included in the response\&.
  849. .fi
  850. .if n \{\
  851. .RE
  852. .\}
  853. .RE
  854. .sp
  855. .RS 4
  856. .ie n \{\
  857. \h'-04'\(bu\h'+03'\c
  858. .\}
  859. .el \{\
  860. .sp -1
  861. .IP \(bu 2.3
  862. .\}
  863. Always begins with the section header "wanted\-refs"\&.
  864. .RE
  865. .sp
  866. .RS 4
  867. .ie n \{\
  868. \h'-04'\(bu\h'+03'\c
  869. .\}
  870. .el \{\
  871. .sp -1
  872. .IP \(bu 2.3
  873. .\}
  874. The server will send a ref listing ("<oid> <refname>") for each reference requested using
  875. \fIwant\-ref\fR
  876. lines\&.
  877. .RE
  878. .sp
  879. .RS 4
  880. .ie n \{\
  881. \h'-04'\(bu\h'+03'\c
  882. .\}
  883. .el \{\
  884. .sp -1
  885. .IP \(bu 2.3
  886. .\}
  887. The server MUST NOT send any refs which were not requested using
  888. \fIwant\-ref\fR
  889. lines\&.
  890. .sp
  891. .if n \{\
  892. .RS 4
  893. .\}
  894. .nf
  895. packfile\-uris section
  896. * This section is only included if the client sent
  897. \*(Aqpackfile\-uris\*(Aq and the server has at least one such URI to
  898. send\&.
  899. .fi
  900. .if n \{\
  901. .RE
  902. .\}
  903. .RE
  904. .sp
  905. .RS 4
  906. .ie n \{\
  907. \h'-04'\(bu\h'+03'\c
  908. .\}
  909. .el \{\
  910. .sp -1
  911. .IP \(bu 2.3
  912. .\}
  913. Always begins with the section header "packfile\-uris"\&.
  914. .RE
  915. .sp
  916. .RS 4
  917. .ie n \{\
  918. \h'-04'\(bu\h'+03'\c
  919. .\}
  920. .el \{\
  921. .sp -1
  922. .IP \(bu 2.3
  923. .\}
  924. For each URI the server sends, it sends a hash of the pack\(cqs contents (as output by git index\-pack) followed by the URI\&.
  925. .RE
  926. .sp
  927. .RS 4
  928. .ie n \{\
  929. \h'-04'\(bu\h'+03'\c
  930. .\}
  931. .el \{\
  932. .sp -1
  933. .IP \(bu 2.3
  934. .\}
  935. The hashes are 40 hex characters long\&. When Git upgrades to a new hash algorithm, this might need to be updated\&. (It should match whatever index\-pack outputs after "pack\et" or "keep\et"\&.
  936. .sp
  937. .if n \{\
  938. .RS 4
  939. .\}
  940. .nf
  941. packfile section
  942. * This section is only included if the client has sent \*(Aqwant\*(Aq
  943. lines in its request and either requested that no more
  944. negotiation be done by sending \*(Aqdone\*(Aq or if the server has
  945. decided it has found a sufficient cut point to produce a
  946. packfile\&.
  947. .fi
  948. .if n \{\
  949. .RE
  950. .\}
  951. .RE
  952. .sp
  953. .RS 4
  954. .ie n \{\
  955. \h'-04'\(bu\h'+03'\c
  956. .\}
  957. .el \{\
  958. .sp -1
  959. .IP \(bu 2.3
  960. .\}
  961. Always begins with the section header "packfile"
  962. .RE
  963. .sp
  964. .RS 4
  965. .ie n \{\
  966. \h'-04'\(bu\h'+03'\c
  967. .\}
  968. .el \{\
  969. .sp -1
  970. .IP \(bu 2.3
  971. .\}
  972. The transmission of the packfile begins immediately after the section header
  973. .RE
  974. .sp
  975. .RS 4
  976. .ie n \{\
  977. \h'-04'\(bu\h'+03'\c
  978. .\}
  979. .el \{\
  980. .sp -1
  981. .IP \(bu 2.3
  982. .\}
  983. The data transfer of the packfile is always multiplexed, using the same semantics of the
  984. \fIside\-band\-64k\fR
  985. capability from protocol version 1\&. This means that each packet, during the packfile data stream, is made up of a leading 4\-byte pkt\-line length (typical of the pkt\-line format), followed by a 1\-byte stream code, followed by the actual data\&.
  986. .sp
  987. .if n \{\
  988. .RS 4
  989. .\}
  990. .nf
  991. The stream code can be one of:
  992. 1 \- pack data
  993. 2 \- progress messages
  994. 3 \- fatal error message just before stream aborts
  995. .fi
  996. .if n \{\
  997. .RE
  998. .\}
  999. .RE
  1000. .SS "server\-option"
  1001. .sp
  1002. If advertised, indicates that any number of server specific options can be included in a request\&. This is done by sending each option as a "server\-option=<option>" capability line in the capability\-list section of a request\&.
  1003. .sp
  1004. The provided options must not contain a NUL or LF character\&.
  1005. .SS "object\-format"
  1006. .sp
  1007. The server can advertise the \fBobject\-format\fR capability with a value \fBX\fR (in the form \fBobject\-format=X\fR) to notify the client that the server is able to deal with objects using hash algorithm X\&. If not specified, the server is assumed to only handle SHA\-1\&. If the client would like to use a hash algorithm other than SHA\-1, it should specify its object\-format string\&.
  1008. .SS "session\-id=<session\-id>"
  1009. .sp
  1010. 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\&.
  1011. .sp
  1012. 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\&.
  1013. .SS "object\-info"
  1014. .sp
  1015. \fBobject\-info\fR is the command to retrieve information about one or more objects\&. Its main purpose is to allow a client to make decisions based on this information without having to fully fetch objects\&. Object size is the only information that is currently supported\&.
  1016. .sp
  1017. An \fBobject\-info\fR request takes the following arguments:
  1018. .sp
  1019. .if n \{\
  1020. .RS 4
  1021. .\}
  1022. .nf
  1023. size
  1024. Requests size information to be returned for each listed object id\&.
  1025. .fi
  1026. .if n \{\
  1027. .RE
  1028. .\}
  1029. .sp
  1030. .if n \{\
  1031. .RS 4
  1032. .\}
  1033. .nf
  1034. oid <oid>
  1035. Indicates to the server an object which the client wants to obtain
  1036. information for\&.
  1037. .fi
  1038. .if n \{\
  1039. .RE
  1040. .\}
  1041. .sp
  1042. The response of \fBobject\-info\fR is a list of the requested object ids and associated requested information, each separated by a single space\&.
  1043. .sp
  1044. .if n \{\
  1045. .RS 4
  1046. .\}
  1047. .nf
  1048. output = info flush\-pkt
  1049. .fi
  1050. .if n \{\
  1051. .RE
  1052. .\}
  1053. .sp
  1054. .if n \{\
  1055. .RS 4
  1056. .\}
  1057. .nf
  1058. info = PKT\-LINE(attrs) LF)
  1059. *PKT\-LINE(obj\-info LF)
  1060. .fi
  1061. .if n \{\
  1062. .RE
  1063. .\}
  1064. .sp
  1065. .if n \{\
  1066. .RS 4
  1067. .\}
  1068. .nf
  1069. attrs = attr | attrs SP attrs
  1070. .fi
  1071. .if n \{\
  1072. .RE
  1073. .\}
  1074. .sp
  1075. .if n \{\
  1076. .RS 4
  1077. .\}
  1078. .nf
  1079. attr = "size"
  1080. .fi
  1081. .if n \{\
  1082. .RE
  1083. .\}
  1084. .sp
  1085. .if n \{\
  1086. .RS 4
  1087. .\}
  1088. .nf
  1089. obj\-info = obj\-id SP obj\-size
  1090. .fi
  1091. .if n \{\
  1092. .RE
  1093. .\}
  1094. .SS "bundle\-uri"
  1095. .sp
  1096. If the \fIbundle\-uri\fR capability is advertised, the server supports the \(lqbundle\-uri\(rq command\&.
  1097. .sp
  1098. The capability is currently advertised with no value (i\&.e\&. not "bundle\-uri=somevalue"), a value may be added in the future for supporting command\-wide extensions\&. Clients MUST ignore any unknown capability values and proceed with the \*(Aqbundle\-uri` dialog they support\&.
  1099. .sp
  1100. The \fIbundle\-uri\fR command is intended to be issued before \fBfetch\fR to get URIs to bundle files (see \fBgit-bundle\fR(1)) to "seed" and inform the subsequent \fBfetch\fR command\&.
  1101. .sp
  1102. The client CAN issue \fBbundle\-uri\fR before or after any other valid command\&. To be useful to clients it\(cqs expected that it\(cqll be issued after an \fBls\-refs\fR and before \fBfetch\fR, but CAN be issued at any time in the dialog\&.
  1103. .sp
  1104. .it 1 an-trap
  1105. .nr an-no-space-flag 1
  1106. .nr an-break-flag 1
  1107. .br
  1108. .ps +1
  1109. \fBDISCUSSION of bundle-uri\fR
  1110. .RS 4
  1111. .sp
  1112. The intent of the feature is optimize for server resource consumption in the common case by changing the common case of fetching a very large PACK during \fBgit-clone\fR(1) into a smaller incremental fetch\&.
  1113. .sp
  1114. It also allows servers to achieve better caching in combination with an \fBuploadpack\&.packObjectsHook\fR (see \fBgit-config\fR(1))\&.
  1115. .sp
  1116. By having new clones or fetches be a more predictable and common negotiation against the tips of recently produces *\&.bundle file(s)\&. Servers might even pre\-generate the results of such negotiations for the \fBuploadpack\&.packObjectsHook\fR as new pushes come in\&.
  1117. .sp
  1118. One way that servers could take advantage of these bundles is that the server would anticipate that fresh clones will download a known bundle, followed by catching up to the current state of the repository using ref tips found in that bundle (or bundles)\&.
  1119. .RE
  1120. .sp
  1121. .it 1 an-trap
  1122. .nr an-no-space-flag 1
  1123. .nr an-break-flag 1
  1124. .br
  1125. .ps +1
  1126. \fBPROTOCOL for bundle-uri\fR
  1127. .RS 4
  1128. .sp
  1129. A \fBbundle\-uri\fR request takes no arguments, and as noted above does not currently advertise a capability value\&. Both may be added in the future\&.
  1130. .sp
  1131. When the client issues a \fBcommand=bundle\-uri\fR request, the response is a list of key\-value pairs provided as packet lines with value \fI<key>\fR\fB=\fR\fI<value>\fR\&. Each \fI<key>\fR should be interpreted as a config key from the \fBbundle\&.\fR* namespace to construct a list of bundles\&. These keys are grouped by a \fBbundle\&.\fR\fI<id>\fR\&. subsection, where each key corresponding to a given \fI<id>\fR contributes attributes to the bundle defined by that \fI<id>\fR\&. See \fBgit-config\fR(1) for the specific details of these keys and how the Git client will interpret their values\&.
  1132. .sp
  1133. Clients MUST parse the line according to the above format, lines that do not conform to the format SHOULD be discarded\&. The user MAY be warned in such a case\&.
  1134. .RE
  1135. .sp
  1136. .it 1 an-trap
  1137. .nr an-no-space-flag 1
  1138. .nr an-break-flag 1
  1139. .br
  1140. .ps +1
  1141. \fBbundle-uri CLIENT AND SERVER EXPECTATIONS\fR
  1142. .RS 4
  1143. .PP
  1144. URI CONTENTS
  1145. .RS 4
  1146. The content at the advertised URIs MUST be one of two types\&.
  1147. .sp
  1148. The advertised URI may contain a bundle file that
  1149. \fBgit\fR
  1150. \fBbundle\fR
  1151. \fBverify\fR
  1152. would accept\&. I\&.e\&. they MUST contain one or more reference tips for use by the client, MUST indicate prerequisites (in any) with standard "\-" prefixes, and MUST indicate their "object\-format", if applicable\&.
  1153. .sp
  1154. The advertised URI may alternatively contain a plaintext file that
  1155. \fBgit\fR
  1156. \fBconfig\fR
  1157. \fB\-\-list\fR
  1158. would accept (with the
  1159. \fB\-\-file\fR
  1160. option)\&. The key\-value pairs in this list are in the
  1161. \fBbundle\&.\fR* namespace (see
  1162. \fBgit-config\fR(1))\&.
  1163. .RE
  1164. .PP
  1165. bundle\-uri CLIENT ERROR RECOVERY
  1166. .RS 4
  1167. A client MUST above all gracefully degrade on errors, whether that error is because of bad missing/data in the bundle URI(s), because that client is too dumb to e\&.g\&. understand and fully parse out bundle headers and their prerequisite relationships, or something else\&.
  1168. .sp
  1169. Server operators should feel confident in turning on "bundle\-uri" and not worry if e\&.g\&. their CDN goes down that clones or fetches will run into hard failures\&. Even if the server bundle(s) are incomplete, or bad in some way the client should still end up with a functioning repository, just as if it had chosen not to use this protocol extension\&.
  1170. .sp
  1171. All subsequent discussion on client and server interaction MUST keep this in mind\&.
  1172. .RE
  1173. .PP
  1174. bundle\-uri SERVER TO CLIENT
  1175. .RS 4
  1176. The ordering of the returned bundle uris is not significant\&. Clients MUST parse their headers to discover their contained OIDS and prerequisites\&. A client MUST consider the content of the bundle(s) themselves and their header as the ultimate source of truth\&.
  1177. .sp
  1178. A server MAY even return bundle(s) that don\(cqt have any direct relationship to the repository being cloned (either through accident, or intentional "clever" configuration), and expect a client to sort out what data they\(cqd like from the bundle(s), if any\&.
  1179. .RE
  1180. .PP
  1181. bundle\-uri CLIENT TO SERVER
  1182. .RS 4
  1183. The client SHOULD provide reference tips found in the bundle header(s) as
  1184. \fIhave\fR
  1185. lines in any subsequent
  1186. \fBfetch\fR
  1187. request\&. A client MAY also ignore the bundle(s) entirely if doing so is deemed worse for some reason, e\&.g\&. if the bundles can\(cqt be downloaded, it doesn\(cqt like the tips it finds etc\&.
  1188. .RE
  1189. .PP
  1190. WHEN ADVERTISED BUNDLE(S) REQUIRE NO FURTHER NEGOTIATION
  1191. .RS 4
  1192. If after issuing
  1193. \fBbundle\-uri\fR
  1194. and
  1195. \fBls\-refs\fR, and getting the header(s) of the bundle(s) the client finds that the ref tips it wants can be retrieved entirely from advertised bundle(s), the client MAY disconnect from the Git server\&. The results of such a
  1196. \fIclone\fR
  1197. or
  1198. \fIfetch\fR
  1199. should be indistinguishable from the state attained without using bundle\-uri\&.
  1200. .RE
  1201. .PP
  1202. EARLY CLIENT DISCONNECTIONS AND ERROR RECOVERY
  1203. .RS 4
  1204. A client MAY perform an early disconnect while still downloading the bundle(s) (having streamed and parsed their headers)\&. In such a case the client MUST gracefully recover from any errors related to finishing the download and validation of the bundle(s)\&.
  1205. .sp
  1206. I\&.e\&. a client might need to re\-connect and issue a
  1207. \fIfetch\fR
  1208. command, and possibly fall back to not making use of
  1209. \fIbundle\-uri\fR
  1210. at all\&.
  1211. .sp
  1212. This "MAY" behavior is specified as such (and not a "SHOULD") on the assumption that a server advertising bundle uris is more likely than not to be serving up a relatively large repository, and to be pointing to URIs that have a good chance of being in working order\&. A client MAY e\&.g\&. look at the payload size of the bundles as a heuristic to see if an early disconnect is worth it, should falling back on a full "fetch" dialog be necessary\&.
  1213. .RE
  1214. .PP
  1215. WHEN ADVERTISED BUNDLE(S) REQUIRE FURTHER NEGOTIATION
  1216. .RS 4
  1217. A client SHOULD commence a negotiation of a PACK from the server via the "fetch" command using the OID tips found in advertised bundles, even if\(cqs still in the process of downloading those bundle(s)\&.
  1218. .sp
  1219. This allows for aggressive early disconnects from any interactive server dialog\&. The client blindly trusts that the advertised OID tips are relevant, and issues them as
  1220. \fIhave\fR
  1221. lines, it then requests any tips it would like (usually from the "ls\-refs" advertisement) via
  1222. \fIwant\fR
  1223. lines\&. The server will then compute a (hopefully small) PACK with the expected difference between the tips from the bundle(s) and the data requested\&.
  1224. .sp
  1225. The only connection the client then needs to keep active is to the concurrently downloading static bundle(s), when those and the incremental PACK are retrieved they should be inflated and validated\&. Any errors at this point should be gracefully recovered from, see above\&.
  1226. .RE
  1227. .RE
  1228. .sp
  1229. .it 1 an-trap
  1230. .nr an-no-space-flag 1
  1231. .nr an-break-flag 1
  1232. .br
  1233. .ps +1
  1234. \fBbundle-uri PROTOCOL FEATURES\fR
  1235. .RS 4
  1236. .sp
  1237. The client constructs a bundle list from the \fI<key>\fR\fB=\fR\fI<value>\fR pairs provided by the server\&. These pairs are part of the \fBbundle\&.\fR* namespace as documented in \fBgit-config\fR(1)\&. In this section, we discuss some of these keys and describe the actions the client will do in response to this information\&.
  1238. .sp
  1239. In particular, the \fBbundle\&.version\fR key specifies an integer value\&. The only accepted value at the moment is \fB1\fR, but if the client sees an unexpected value here then the client MUST ignore the bundle list\&.
  1240. .sp
  1241. As long as \fBbundle\&.version\fR is understood, all other unknown keys MAY be ignored by the client\&. The server will guarantee compatibility with older clients, though newer clients may be better able to use the extra keys to minimize downloads\&.
  1242. .sp
  1243. Any backwards\-incompatible addition of pre\-URI key\-value will be guarded by a new \fBbundle\&.version\fR value or values in \fIbundle\-uri\fR capability advertisement itself, and/or by new future \fBbundle\-uri\fR request arguments\&.
  1244. .sp
  1245. Some example key\-value pairs that are not currently implemented but could be implemented in the future include:
  1246. .sp
  1247. .RS 4
  1248. .ie n \{\
  1249. \h'-04'\(bu\h'+03'\c
  1250. .\}
  1251. .el \{\
  1252. .sp -1
  1253. .IP \(bu 2.3
  1254. .\}
  1255. Add a "hash=<val>" or "size=<bytes>" advertise the expected hash or size of the bundle file\&.
  1256. .RE
  1257. .sp
  1258. .RS 4
  1259. .ie n \{\
  1260. \h'-04'\(bu\h'+03'\c
  1261. .\}
  1262. .el \{\
  1263. .sp -1
  1264. .IP \(bu 2.3
  1265. .\}
  1266. Advertise that one or more bundle files are the same (to e\&.g\&. have clients round\-robin or otherwise choose one of N possible files)\&.
  1267. .RE
  1268. .sp
  1269. .RS 4
  1270. .ie n \{\
  1271. \h'-04'\(bu\h'+03'\c
  1272. .\}
  1273. .el \{\
  1274. .sp -1
  1275. .IP \(bu 2.3
  1276. .\}
  1277. A "oid=<OID>" shortcut and "prerequisite=<OID>" shortcut\&. For expressing the common case of a bundle with one tip and no prerequisites, or one tip and one prerequisite\&.
  1278. .sp
  1279. This would allow for optimizing the common case of servers who\(cqd like to provide one "big bundle" containing only their "main" branch, and/or incremental updates thereof\&.
  1280. .sp
  1281. A client receiving such a response MAY assume that they can skip retrieving the header from a bundle at the indicated URI, and thus save themselves and the server(s) the request(s) needed to inspect the headers of that bundle or bundles\&.
  1282. .RE
  1283. .RE
  1284. .SS "promisor\-remote=<pr\-infos>"
  1285. .sp
  1286. The server may advertise some promisor remotes it is using or knows about to a client which may want to use them as its promisor remotes, instead of this repository\&. In this case <pr\-infos> should be of the form:
  1287. .sp
  1288. .if n \{\
  1289. .RS 4
  1290. .\}
  1291. .nf
  1292. pr\-infos = pr\-info | pr\-infos ";" pr\-info
  1293. .fi
  1294. .if n \{\
  1295. .RE
  1296. .\}
  1297. .sp
  1298. .if n \{\
  1299. .RS 4
  1300. .\}
  1301. .nf
  1302. pr\-info = "name=" pr\-name | "name=" pr\-name "," "url=" pr\-url
  1303. .fi
  1304. .if n \{\
  1305. .RE
  1306. .\}
  1307. .sp
  1308. where \fBpr\-name\fR is the urlencoded name of a promisor remote, and \fBpr\-url\fR the urlencoded URL of that promisor remote\&.
  1309. .sp
  1310. In this case, if the client decides to use one or more promisor remotes the server advertised, it can reply with "promisor\-remote=<pr\-names>" where <pr\-names> should be of the form:
  1311. .sp
  1312. .if n \{\
  1313. .RS 4
  1314. .\}
  1315. .nf
  1316. pr\-names = pr\-name | pr\-names ";" pr\-name
  1317. .fi
  1318. .if n \{\
  1319. .RE
  1320. .\}
  1321. .sp
  1322. where \fBpr\-name\fR is the urlencoded name of a promisor remote the server advertised and the client accepts\&.
  1323. .sp
  1324. Note that, everywhere in this document, \fBpr\-name\fR MUST be a valid remote name, and the \fI;\fR and \fI,\fR characters MUST be encoded if they appear in \fBpr\-name\fR or \fBpr\-url\fR\&.
  1325. .sp
  1326. If the server doesn\(cqt know any promisor remote that could be good for a client to use, or prefers a client not to use any promisor remote it uses or knows about, it shouldn\(cqt advertise the "promisor\-remote" capability at all\&.
  1327. .sp
  1328. In this case, or if the client doesn\(cqt want to use any promisor remote the server advertised, the client shouldn\(cqt advertise the "promisor\-remote" capability at all in its reply\&.
  1329. .sp
  1330. The "promisor\&.advertise" and "promisor\&.acceptFromServer" configuration options can be used on the server and client side to control what they advertise or accept respectively\&. See the documentation of these configuration options for more information\&.
  1331. .sp
  1332. Note that in the future it would be nice if the "promisor\-remote" protocol capability could be used by the server, when responding to \fBgit\fR \fBfetch\fR or \fBgit\fR \fBclone\fR, to advertise better\-connected remotes that the client can use as promisor remotes, instead of this repository, so that the client can lazily fetch objects from these other better\-connected remotes\&. This would require the server to omit in its response the objects available on the better\-connected remotes that the client has accepted\&. This hasn\(cqt been implemented yet though\&. So for now this "promisor\-remote" capability is useful only when the server advertises some promisor remotes it already uses to borrow objects from\&.
  1333. .SH "GIT"
  1334. .sp
  1335. Part of the \fBgit\fR(1) suite
  1336. .SH "NOTES"
  1337. .IP " 1." 4
  1338. api-trace2
  1339. .RS 4
  1340. \%git-htmldocs/technical/api-trace2.html
  1341. .RE