Junio C Hamano | ccb8252 | 2018-05-08 07:52:09 | [diff] [blame] | 1 | <?xml version="1.0" encoding="UTF-8"?> |
| 2 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" |
| 3 | "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> |
| 4 | <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> |
| 5 | <head> |
| 6 | <meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8" /> |
Junio C Hamano | 98c882d | 2020-08-13 22:06:57 | [diff] [blame] | 7 | <meta name="generator" content="AsciiDoc 9.0.0rc2" /> |
Junio C Hamano | b551377 | 2019-04-22 03:38:39 | [diff] [blame] | 8 | <title>Git Wire Protocol, Version 2</title> |
Junio C Hamano | ccb8252 | 2018-05-08 07:52:09 | [diff] [blame] | 9 | <style type="text/css"> |
| 10 | /* Shared CSS for AsciiDoc xhtml11 and html5 backends */ |
| 11 | |
| 12 | /* Default font. */ |
| 13 | body { |
| 14 | font-family: Georgia,serif; |
| 15 | } |
| 16 | |
| 17 | /* Title font. */ |
| 18 | h1, h2, h3, h4, h5, h6, |
| 19 | div.title, caption.title, |
| 20 | thead, p.table.header, |
| 21 | #toctitle, |
| 22 | #author, #revnumber, #revdate, #revremark, |
| 23 | #footer { |
| 24 | font-family: Arial,Helvetica,sans-serif; |
| 25 | } |
| 26 | |
| 27 | body { |
| 28 | margin: 1em 5% 1em 5%; |
| 29 | } |
| 30 | |
| 31 | a { |
| 32 | color: blue; |
| 33 | text-decoration: underline; |
| 34 | } |
| 35 | a:visited { |
| 36 | color: fuchsia; |
| 37 | } |
| 38 | |
| 39 | em { |
| 40 | font-style: italic; |
| 41 | color: navy; |
| 42 | } |
| 43 | |
| 44 | strong { |
| 45 | font-weight: bold; |
| 46 | color: #083194; |
| 47 | } |
| 48 | |
| 49 | h1, h2, h3, h4, h5, h6 { |
| 50 | color: #527bbd; |
| 51 | margin-top: 1.2em; |
| 52 | margin-bottom: 0.5em; |
| 53 | line-height: 1.3; |
| 54 | } |
| 55 | |
| 56 | h1, h2, h3 { |
| 57 | border-bottom: 2px solid silver; |
| 58 | } |
| 59 | h2 { |
| 60 | padding-top: 0.5em; |
| 61 | } |
| 62 | h3 { |
| 63 | float: left; |
| 64 | } |
| 65 | h3 + * { |
| 66 | clear: left; |
| 67 | } |
| 68 | h5 { |
| 69 | font-size: 1.0em; |
| 70 | } |
| 71 | |
| 72 | div.sectionbody { |
| 73 | margin-left: 0; |
| 74 | } |
| 75 | |
| 76 | hr { |
| 77 | border: 1px solid silver; |
| 78 | } |
| 79 | |
| 80 | p { |
| 81 | margin-top: 0.5em; |
| 82 | margin-bottom: 0.5em; |
| 83 | } |
| 84 | |
| 85 | ul, ol, li > p { |
| 86 | margin-top: 0; |
| 87 | } |
| 88 | ul > li { color: #aaa; } |
| 89 | ul > li > * { color: black; } |
| 90 | |
| 91 | .monospaced, code, pre { |
| 92 | font-family: "Courier New", Courier, monospace; |
| 93 | font-size: inherit; |
| 94 | color: navy; |
| 95 | padding: 0; |
| 96 | margin: 0; |
| 97 | } |
| 98 | pre { |
| 99 | white-space: pre-wrap; |
| 100 | } |
| 101 | |
| 102 | #author { |
| 103 | color: #527bbd; |
| 104 | font-weight: bold; |
| 105 | font-size: 1.1em; |
| 106 | } |
| 107 | #email { |
| 108 | } |
| 109 | #revnumber, #revdate, #revremark { |
| 110 | } |
| 111 | |
| 112 | #footer { |
| 113 | font-size: small; |
| 114 | border-top: 2px solid silver; |
| 115 | padding-top: 0.5em; |
| 116 | margin-top: 4.0em; |
| 117 | } |
| 118 | #footer-text { |
| 119 | float: left; |
| 120 | padding-bottom: 0.5em; |
| 121 | } |
| 122 | #footer-badges { |
| 123 | float: right; |
| 124 | padding-bottom: 0.5em; |
| 125 | } |
| 126 | |
| 127 | #preamble { |
| 128 | margin-top: 1.5em; |
| 129 | margin-bottom: 1.5em; |
| 130 | } |
| 131 | div.imageblock, div.exampleblock, div.verseblock, |
| 132 | div.quoteblock, div.literalblock, div.listingblock, div.sidebarblock, |
| 133 | div.admonitionblock { |
| 134 | margin-top: 1.0em; |
| 135 | margin-bottom: 1.5em; |
| 136 | } |
| 137 | div.admonitionblock { |
| 138 | margin-top: 2.0em; |
| 139 | margin-bottom: 2.0em; |
| 140 | margin-right: 10%; |
| 141 | color: #606060; |
| 142 | } |
| 143 | |
| 144 | div.content { /* Block element content. */ |
| 145 | padding: 0; |
| 146 | } |
| 147 | |
| 148 | /* Block element titles. */ |
| 149 | div.title, caption.title { |
| 150 | color: #527bbd; |
| 151 | font-weight: bold; |
| 152 | text-align: left; |
| 153 | margin-top: 1.0em; |
| 154 | margin-bottom: 0.5em; |
| 155 | } |
| 156 | div.title + * { |
| 157 | margin-top: 0; |
| 158 | } |
| 159 | |
| 160 | td div.title:first-child { |
| 161 | margin-top: 0.0em; |
| 162 | } |
| 163 | div.content div.title:first-child { |
| 164 | margin-top: 0.0em; |
| 165 | } |
| 166 | div.content + div.title { |
| 167 | margin-top: 0.0em; |
| 168 | } |
| 169 | |
| 170 | div.sidebarblock > div.content { |
| 171 | background: #ffffee; |
| 172 | border: 1px solid #dddddd; |
| 173 | border-left: 4px solid #f0f0f0; |
| 174 | padding: 0.5em; |
| 175 | } |
| 176 | |
| 177 | div.listingblock > div.content { |
| 178 | border: 1px solid #dddddd; |
| 179 | border-left: 5px solid #f0f0f0; |
| 180 | background: #f8f8f8; |
| 181 | padding: 0.5em; |
| 182 | } |
| 183 | |
| 184 | div.quoteblock, div.verseblock { |
| 185 | padding-left: 1.0em; |
| 186 | margin-left: 1.0em; |
| 187 | margin-right: 10%; |
| 188 | border-left: 5px solid #f0f0f0; |
| 189 | color: #888; |
| 190 | } |
| 191 | |
| 192 | div.quoteblock > div.attribution { |
| 193 | padding-top: 0.5em; |
| 194 | text-align: right; |
| 195 | } |
| 196 | |
| 197 | div.verseblock > pre.content { |
| 198 | font-family: inherit; |
| 199 | font-size: inherit; |
| 200 | } |
| 201 | div.verseblock > div.attribution { |
| 202 | padding-top: 0.75em; |
| 203 | text-align: left; |
| 204 | } |
| 205 | /* DEPRECATED: Pre version 8.2.7 verse style literal block. */ |
| 206 | div.verseblock + div.attribution { |
| 207 | text-align: left; |
| 208 | } |
| 209 | |
| 210 | div.admonitionblock .icon { |
| 211 | vertical-align: top; |
| 212 | font-size: 1.1em; |
| 213 | font-weight: bold; |
| 214 | text-decoration: underline; |
| 215 | color: #527bbd; |
| 216 | padding-right: 0.5em; |
| 217 | } |
| 218 | div.admonitionblock td.content { |
| 219 | padding-left: 0.5em; |
| 220 | border-left: 3px solid #dddddd; |
| 221 | } |
| 222 | |
| 223 | div.exampleblock > div.content { |
| 224 | border-left: 3px solid #dddddd; |
| 225 | padding-left: 0.5em; |
| 226 | } |
| 227 | |
| 228 | div.imageblock div.content { padding-left: 0; } |
| 229 | span.image img { border-style: none; vertical-align: text-bottom; } |
| 230 | a.image:visited { color: white; } |
| 231 | |
| 232 | dl { |
| 233 | margin-top: 0.8em; |
| 234 | margin-bottom: 0.8em; |
| 235 | } |
| 236 | dt { |
| 237 | margin-top: 0.5em; |
| 238 | margin-bottom: 0; |
| 239 | font-style: normal; |
| 240 | color: navy; |
| 241 | } |
| 242 | dd > *:first-child { |
| 243 | margin-top: 0.1em; |
| 244 | } |
| 245 | |
| 246 | ul, ol { |
| 247 | list-style-position: outside; |
| 248 | } |
| 249 | ol.arabic { |
| 250 | list-style-type: decimal; |
| 251 | } |
| 252 | ol.loweralpha { |
| 253 | list-style-type: lower-alpha; |
| 254 | } |
| 255 | ol.upperalpha { |
| 256 | list-style-type: upper-alpha; |
| 257 | } |
| 258 | ol.lowerroman { |
| 259 | list-style-type: lower-roman; |
| 260 | } |
| 261 | ol.upperroman { |
| 262 | list-style-type: upper-roman; |
| 263 | } |
| 264 | |
| 265 | div.compact ul, div.compact ol, |
| 266 | div.compact p, div.compact p, |
| 267 | div.compact div, div.compact div { |
| 268 | margin-top: 0.1em; |
| 269 | margin-bottom: 0.1em; |
| 270 | } |
| 271 | |
| 272 | tfoot { |
| 273 | font-weight: bold; |
| 274 | } |
| 275 | td > div.verse { |
| 276 | white-space: pre; |
| 277 | } |
| 278 | |
| 279 | div.hdlist { |
| 280 | margin-top: 0.8em; |
| 281 | margin-bottom: 0.8em; |
| 282 | } |
| 283 | div.hdlist tr { |
| 284 | padding-bottom: 15px; |
| 285 | } |
| 286 | dt.hdlist1.strong, td.hdlist1.strong { |
| 287 | font-weight: bold; |
| 288 | } |
| 289 | td.hdlist1 { |
| 290 | vertical-align: top; |
| 291 | font-style: normal; |
| 292 | padding-right: 0.8em; |
| 293 | color: navy; |
| 294 | } |
| 295 | td.hdlist2 { |
| 296 | vertical-align: top; |
| 297 | } |
| 298 | div.hdlist.compact tr { |
| 299 | margin: 0; |
| 300 | padding-bottom: 0; |
| 301 | } |
| 302 | |
| 303 | .comment { |
| 304 | background: yellow; |
| 305 | } |
| 306 | |
| 307 | .footnote, .footnoteref { |
| 308 | font-size: 0.8em; |
| 309 | } |
| 310 | |
| 311 | span.footnote, span.footnoteref { |
| 312 | vertical-align: super; |
| 313 | } |
| 314 | |
| 315 | #footnotes { |
| 316 | margin: 20px 0 20px 0; |
| 317 | padding: 7px 0 0 0; |
| 318 | } |
| 319 | |
| 320 | #footnotes div.footnote { |
| 321 | margin: 0 0 5px 0; |
| 322 | } |
| 323 | |
| 324 | #footnotes hr { |
| 325 | border: none; |
| 326 | border-top: 1px solid silver; |
| 327 | height: 1px; |
| 328 | text-align: left; |
| 329 | margin-left: 0; |
| 330 | width: 20%; |
| 331 | min-width: 100px; |
| 332 | } |
| 333 | |
| 334 | div.colist td { |
| 335 | padding-right: 0.5em; |
| 336 | padding-bottom: 0.3em; |
| 337 | vertical-align: top; |
| 338 | } |
| 339 | div.colist td img { |
| 340 | margin-top: 0.3em; |
| 341 | } |
| 342 | |
| 343 | @media print { |
| 344 | #footer-badges { display: none; } |
| 345 | } |
| 346 | |
| 347 | #toc { |
| 348 | margin-bottom: 2.5em; |
| 349 | } |
| 350 | |
| 351 | #toctitle { |
| 352 | color: #527bbd; |
| 353 | font-size: 1.1em; |
| 354 | font-weight: bold; |
| 355 | margin-top: 1.0em; |
| 356 | margin-bottom: 0.1em; |
| 357 | } |
| 358 | |
| 359 | div.toclevel0, div.toclevel1, div.toclevel2, div.toclevel3, div.toclevel4 { |
| 360 | margin-top: 0; |
| 361 | margin-bottom: 0; |
| 362 | } |
| 363 | div.toclevel2 { |
| 364 | margin-left: 2em; |
| 365 | font-size: 0.9em; |
| 366 | } |
| 367 | div.toclevel3 { |
| 368 | margin-left: 4em; |
| 369 | font-size: 0.9em; |
| 370 | } |
| 371 | div.toclevel4 { |
| 372 | margin-left: 6em; |
| 373 | font-size: 0.9em; |
| 374 | } |
| 375 | |
| 376 | span.aqua { color: aqua; } |
| 377 | span.black { color: black; } |
| 378 | span.blue { color: blue; } |
| 379 | span.fuchsia { color: fuchsia; } |
| 380 | span.gray { color: gray; } |
| 381 | span.green { color: green; } |
| 382 | span.lime { color: lime; } |
| 383 | span.maroon { color: maroon; } |
| 384 | span.navy { color: navy; } |
| 385 | span.olive { color: olive; } |
| 386 | span.purple { color: purple; } |
| 387 | span.red { color: red; } |
| 388 | span.silver { color: silver; } |
| 389 | span.teal { color: teal; } |
| 390 | span.white { color: white; } |
| 391 | span.yellow { color: yellow; } |
| 392 | |
| 393 | span.aqua-background { background: aqua; } |
| 394 | span.black-background { background: black; } |
| 395 | span.blue-background { background: blue; } |
| 396 | span.fuchsia-background { background: fuchsia; } |
| 397 | span.gray-background { background: gray; } |
| 398 | span.green-background { background: green; } |
| 399 | span.lime-background { background: lime; } |
| 400 | span.maroon-background { background: maroon; } |
| 401 | span.navy-background { background: navy; } |
| 402 | span.olive-background { background: olive; } |
| 403 | span.purple-background { background: purple; } |
| 404 | span.red-background { background: red; } |
| 405 | span.silver-background { background: silver; } |
| 406 | span.teal-background { background: teal; } |
| 407 | span.white-background { background: white; } |
| 408 | span.yellow-background { background: yellow; } |
| 409 | |
| 410 | span.big { font-size: 2em; } |
| 411 | span.small { font-size: 0.6em; } |
| 412 | |
| 413 | span.underline { text-decoration: underline; } |
| 414 | span.overline { text-decoration: overline; } |
| 415 | span.line-through { text-decoration: line-through; } |
| 416 | |
| 417 | div.unbreakable { page-break-inside: avoid; } |
| 418 | |
| 419 | |
| 420 | /* |
| 421 | * xhtml11 specific |
| 422 | * |
| 423 | * */ |
| 424 | |
| 425 | div.tableblock { |
| 426 | margin-top: 1.0em; |
| 427 | margin-bottom: 1.5em; |
| 428 | } |
| 429 | div.tableblock > table { |
| 430 | border: 3px solid #527bbd; |
| 431 | } |
| 432 | thead, p.table.header { |
| 433 | font-weight: bold; |
| 434 | color: #527bbd; |
| 435 | } |
| 436 | p.table { |
| 437 | margin-top: 0; |
| 438 | } |
Junio C Hamano | 725b0da | 2020-01-22 22:02:40 | [diff] [blame] | 439 | /* Because the table frame attribute is overridden by CSS in most browsers. */ |
Junio C Hamano | ccb8252 | 2018-05-08 07:52:09 | [diff] [blame] | 440 | div.tableblock > table[frame="void"] { |
| 441 | border-style: none; |
| 442 | } |
| 443 | div.tableblock > table[frame="hsides"] { |
| 444 | border-left-style: none; |
| 445 | border-right-style: none; |
| 446 | } |
| 447 | div.tableblock > table[frame="vsides"] { |
| 448 | border-top-style: none; |
| 449 | border-bottom-style: none; |
| 450 | } |
| 451 | |
| 452 | |
| 453 | /* |
| 454 | * html5 specific |
| 455 | * |
| 456 | * */ |
| 457 | |
| 458 | table.tableblock { |
| 459 | margin-top: 1.0em; |
| 460 | margin-bottom: 1.5em; |
| 461 | } |
| 462 | thead, p.tableblock.header { |
| 463 | font-weight: bold; |
| 464 | color: #527bbd; |
| 465 | } |
| 466 | p.tableblock { |
| 467 | margin-top: 0; |
| 468 | } |
| 469 | table.tableblock { |
| 470 | border-width: 3px; |
| 471 | border-spacing: 0px; |
| 472 | border-style: solid; |
| 473 | border-color: #527bbd; |
| 474 | border-collapse: collapse; |
| 475 | } |
| 476 | th.tableblock, td.tableblock { |
| 477 | border-width: 1px; |
| 478 | padding: 4px; |
| 479 | border-style: solid; |
| 480 | border-color: #527bbd; |
| 481 | } |
| 482 | |
| 483 | table.tableblock.frame-topbot { |
| 484 | border-left-style: hidden; |
| 485 | border-right-style: hidden; |
| 486 | } |
| 487 | table.tableblock.frame-sides { |
| 488 | border-top-style: hidden; |
| 489 | border-bottom-style: hidden; |
| 490 | } |
| 491 | table.tableblock.frame-none { |
| 492 | border-style: hidden; |
| 493 | } |
| 494 | |
| 495 | th.tableblock.halign-left, td.tableblock.halign-left { |
| 496 | text-align: left; |
| 497 | } |
| 498 | th.tableblock.halign-center, td.tableblock.halign-center { |
| 499 | text-align: center; |
| 500 | } |
| 501 | th.tableblock.halign-right, td.tableblock.halign-right { |
| 502 | text-align: right; |
| 503 | } |
| 504 | |
| 505 | th.tableblock.valign-top, td.tableblock.valign-top { |
| 506 | vertical-align: top; |
| 507 | } |
| 508 | th.tableblock.valign-middle, td.tableblock.valign-middle { |
| 509 | vertical-align: middle; |
| 510 | } |
| 511 | th.tableblock.valign-bottom, td.tableblock.valign-bottom { |
| 512 | vertical-align: bottom; |
| 513 | } |
| 514 | |
| 515 | |
| 516 | /* |
| 517 | * manpage specific |
| 518 | * |
| 519 | * */ |
| 520 | |
| 521 | body.manpage h1 { |
| 522 | padding-top: 0.5em; |
| 523 | padding-bottom: 0.5em; |
| 524 | border-top: 2px solid silver; |
| 525 | border-bottom: 2px solid silver; |
| 526 | } |
| 527 | body.manpage h2 { |
| 528 | border-style: none; |
| 529 | } |
| 530 | body.manpage div.sectionbody { |
| 531 | margin-left: 3em; |
| 532 | } |
| 533 | |
| 534 | @media print { |
| 535 | body.manpage div#toc { display: none; } |
| 536 | } |
| 537 | |
| 538 | |
| 539 | </style> |
| 540 | <script type="text/javascript"> |
| 541 | /*<+'])'); |
| 584 | // Function that scans the DOM tree for header elements (the DOM2 |
| 585 | // nodeIterator API would be a better technique but not supported by all |
| 586 | // browsers). |
| 587 | var iterate = function (el) { |
| 588 | for (var i = el.firstChild; i != null; i = i.nextSibling) { |
| 589 | if (i.nodeType == 1 /* Node.ELEMENT_NODE */) { |
| 590 | var mo = re.exec(i.tagName); |
| 591 | if (mo && (i.getAttribute("class") || i.getAttribute("className")) != "float") { |
| 592 | result[result.length] = new TocEntry(i, getText(i), mo[1]-1); |
| 593 | } |
| 594 | iterate(i); |
| 595 | } |
| 596 | } |
| 597 | } |
| 598 | iterate(el); |
| 599 | return result; |
| 600 | } |
| 601 | |
| 602 | var toc = document.getElementById("toc"); |
| 603 | if (!toc) { |
| 604 | return; |
| 605 | } |
| 606 | |
| 607 | // Delete existing TOC entries in case we're reloading the TOC. |
| 608 | var tocEntriesToRemove = []; |
| 609 | var i; |
| 610 | for (i = 0; i < toc.childNodes.length; i++) { |
| 611 | var entry = toc.childNodes[i]; |
| 612 | if (entry.nodeName.toLowerCase() == 'div' |
| 613 | && entry.getAttribute("class") |
| 614 | && entry.getAttribute("class").match(/^toclevel/)) |
| 615 | tocEntriesToRemove.push(entry); |
| 616 | } |
| 617 | for (i = 0; i < tocEntriesToRemove.length; i++) { |
| 618 | toc.removeChild(tocEntriesToRemove[i]); |
| 619 | } |
| 620 | |
| 621 | // Rebuild TOC entries. |
| 622 | var entries = tocEntries(document.getElementById("content"), toclevels); |
| 623 | for (var i = 0; i < entries.length; ++i) { |
| 624 | var entry = entries[i]; |
| 625 | if (entry.element.id == "") |
| 626 | entry.element.id = "_toc_" + i; |
| 627 | var a = document.createElement("a"); |
| 628 | a.href = "#" + entry.element.id; |
| 629 | a.appendChild(document.createTextNode(entry.text)); |
| 630 | var div = document.createElement("div"); |
| 631 | div.appendChild(a); |
| 632 | div.className = "toclevel" + entry.toclevel; |
| 633 | toc.appendChild(div); |
| 634 | } |
| 635 | if (entries.length == 0) |
| 636 | toc.parentNode.removeChild(toc); |
| 637 | }, |
| 638 | |
| 639 | |
| 640 | ///////////////////////////////////////////////////////////////////// |
| 641 | // Footnotes generator |
| 642 | ///////////////////////////////////////////////////////////////////// |
| 643 | |
| 644 | /* Based on footnote generation code from: |
| 645 | * http://www.brandspankingnew.net/archive/2005/07/format_footnote.html |
| 646 | */ |
| 647 | |
| 648 | footnotes: function () { |
| 649 | // Delete existing footnote entries in case we're reloading the footnodes. |
| 650 | var i; |
| 651 | var noteholder = document.getElementById("footnotes"); |
| 652 | if (!noteholder) { |
| 653 | return; |
| 654 | } |
| 655 | var entriesToRemove = []; |
| 656 | for (i = 0; i < noteholder.childNodes.length; i++) { |
| 657 | var entry = noteholder.childNodes[i]; |
| 658 | if (entry.nodeName.toLowerCase() == 'div' && entry.getAttribute("class") == "footnote") |
| 659 | entriesToRemove.push(entry); |
| 660 | } |
| 661 | for (i = 0; i < entriesToRemove.length; i++) { |
| 662 | noteholder.removeChild(entriesToRemove[i]); |
| 663 | } |
| 664 | |
| 665 | // Rebuild footnote entries. |
| 666 | var cont = document.getElementById("content"); |
| 667 | var spans = cont.getElementsByTagName("span"); |
| 668 | var refs = {}; |
| 669 | var n = 0; |
| 670 | for (i=0; i<spans.length; i++) { |
| 671 | if (spans[i].className == "footnote") { |
| 672 | n++; |
| 673 | var note = spans[i].getAttribute("data-note"); |
| 674 | if (!note) { |
| 675 | // Use [\s\S] in place of . so multi-line matches work. |
| 676 | // Because JavaScript has no s (dotall) regex flag. |
| 677 | note = spans[i].innerHTML.match(/\s*\[([\s\S]*)]\s*/)[1]; |
| 678 | spans[i].innerHTML = |
| 679 | "[<a id='_footnoteref_" + n + "' href='#_footnote_" + n + |
| 680 | "' title='View footnote' class='footnote'>" + n + "</a>]"; |
| 681 | spans[i].setAttribute("data-note", note); |
| 682 | } |
| 683 | noteholder.innerHTML += |
| 684 | "<div class='footnote' id='_footnote_" + n + "'>" + |
| 685 | "<a href='#_footnoteref_" + n + "' title='Return to text'>" + |
| 686 | n + "</a>. " + note + "</div>"; |
| 687 | var id =spans[i].getAttribute("id"); |
| 688 | if (id != null) refs["#"+id] = n; |
| 689 | } |
| 690 | } |
| 691 | if (n == 0) |
| 692 | noteholder.parentNode.removeChild(noteholder); |
| 693 | else { |
| 694 | // Process footnoterefs. |
| 695 | for (i=0; i<spans.length; i++) { |
| 696 | if (spans[i].className == "footnoteref") { |
| 697 | var href = spans[i].getElementsByTagName("a")[0].getAttribute("href"); |
| 698 | href = href.match(/#.*/)[0]; // Because IE return full URL. |
| 699 | n = refs[href]; |
| 700 | spans[i].innerHTML = |
| 701 | "[<a href='#_footnote_" + n + |
| 702 | "' title='View footnote' class='footnote'>" + n + "</a>]"; |
| 703 | } |
| 704 | } |
| 705 | } |
| 706 | }, |
| 707 | |
| 708 | install: function(toclevels) { |
| 709 | var timerId; |
| 710 | |
| 711 | function reinstall() { |
| 712 | asciidoc.footnotes(); |
| 713 | if (toclevels) { |
| 714 | asciidoc.toc(toclevels); |
| 715 | } |
| 716 | } |
| 717 | |
| 718 | function reinstallAndRemoveTimer() { |
| 719 | clearInterval(timerId); |
| 720 | reinstall(); |
| 721 | } |
| 722 | |
| 723 | timerId = setInterval(reinstall, 500); |
| 724 | if (document.addEventListener) |
| 725 | document.addEventListener("DOMContentLoaded", reinstallAndRemoveTimer, false); |
| 726 | else |
| 727 | window.onload = reinstallAndRemoveTimer; |
| 728 | } |
| 729 | |
| 730 | } |
| 731 | asciidoc.install(); |
| 732 | /*]]>*/ |
| 733 | </script> |
| 734 | </head> |
| 735 | <body class="article"> |
| 736 | <div id="header"> |
Junio C Hamano | b551377 | 2019-04-22 03:38:39 | [diff] [blame] | 737 | <h1>Git Wire Protocol, Version 2</h1> |
Junio C Hamano | ccb8252 | 2018-05-08 07:52:09 | [diff] [blame] | 738 | </div> |
| 739 | <div id="content"> |
| 740 | <div id="preamble"> |
| 741 | <div class="sectionbody"> |
| 742 | <div class="paragraph"><p>This document presents a specification for a version 2 of Git’s wire |
| 743 | protocol. Protocol v2 will improve upon v1 in the following ways:</p></div> |
| 744 | <div class="ulist"><ul> |
| 745 | <li> |
| 746 | <p> |
| 747 | Instead of multiple service names, multiple commands will be |
| 748 | supported by a single service |
| 749 | </p> |
| 750 | </li> |
| 751 | <li> |
| 752 | <p> |
| 753 | Easily extendable as capabilities are moved into their own section |
| 754 | of the protocol, no longer being hidden behind a NUL byte and |
| 755 | limited by the size of a pkt-line |
| 756 | </p> |
| 757 | </li> |
| 758 | <li> |
| 759 | <p> |
| 760 | Separate out other information hidden behind NUL bytes (e.g. agent |
| 761 | string as a capability and symrefs can be requested using <em>ls-refs</em>) |
| 762 | </p> |
| 763 | </li> |
| 764 | <li> |
| 765 | <p> |
| 766 | Reference advertisement will be omitted unless explicitly requested |
| 767 | </p> |
| 768 | </li> |
| 769 | <li> |
| 770 | <p> |
| 771 | ls-refs command to explicitly request some refs |
| 772 | </p> |
| 773 | </li> |
| 774 | <li> |
| 775 | <p> |
| 776 | Designed with http and stateless-rpc in mind. With clear flush |
| 777 | semantics the http remote helper can simply act as a proxy |
| 778 | </p> |
| 779 | </li> |
| 780 | </ul></div> |
| 781 | <div class="paragraph"><p>In protocol v2 communication is command oriented. When first contacting a |
| 782 | server a list of capabilities will advertised. Some of these capabilities |
| 783 | will be commands which a client can request be executed. Once a command |
| 784 | has completed, a client can reuse the connection and request that other |
| 785 | commands be executed.</p></div> |
| 786 | </div> |
| 787 | </div> |
| 788 | <div class="sect1"> |
Junio C Hamano | b551377 | 2019-04-22 03:38:39 | [diff] [blame] | 789 | <h2 id="_packet_line_framing">Packet-Line Framing</h2> |
Junio C Hamano | ccb8252 | 2018-05-08 07:52:09 | [diff] [blame] | 790 | <div class="sectionbody"> |
| 791 | <div class="paragraph"><p>All communication is done using packet-line framing, just as in v1. See |
| 792 | <code>Documentation/technical/pack-protocol.txt</code> and |
| 793 | <code>Documentation/technical/protocol-common.txt</code> for more information.</p></div> |
| 794 | <div class="paragraph"><p>In protocol v2 these special packets will have the following semantics:</p></div> |
| 795 | <div class="ulist"><ul> |
| 796 | <li> |
| 797 | <p> |
| 798 | <em>0000</em> Flush Packet (flush-pkt) - indicates the end of a message |
| 799 | </p> |
| 800 | </li> |
| 801 | <li> |
| 802 | <p> |
| 803 | <em>0001</em> Delimiter Packet (delim-pkt) - separates sections of a message |
| 804 | </p> |
| 805 | </li> |
Junio C Hamano | 19f41f0 | 2020-06-09 01:34:59 | [diff] [blame] | 806 | <li> |
| 807 | <p> |
Junio C Hamano | a372d5b | 2021-02-26 01:34:37 | [diff] [blame] | 808 | <em>0002</em> Response End Packet (response-end-pkt) - indicates the end of a |
| 809 | response for stateless connections |
Junio C Hamano | 19f41f0 | 2020-06-09 01:34:59 | [diff] [blame] | 810 | </p> |
| 811 | </li> |
Junio C Hamano | ccb8252 | 2018-05-08 07:52:09 | [diff] [blame] | 812 | </ul></div> |
| 813 | </div> |
| 814 | </div> |
| 815 | <div class="sect1"> |
Junio C Hamano | b551377 | 2019-04-22 03:38:39 | [diff] [blame] | 816 | <h2 id="_initial_client_request">Initial Client Request</h2> |
Junio C Hamano | ccb8252 | 2018-05-08 07:52:09 | [diff] [blame] | 817 | <div class="sectionbody"> |
| 818 | <div class="paragraph"><p>In general a client can request to speak protocol v2 by sending |
| 819 | <code>version=2</code> through the respective side-channel for the transport being |
| 820 | used which inevitably sets <code>GIT_PROTOCOL</code>. More information can be |
| 821 | found in <code>pack-protocol.txt</code> and <code>http-protocol.txt</code>. In all cases the |
| 822 | response from the server is the capability advertisement.</p></div> |
| 823 | <div class="sect2"> |
Junio C Hamano | b551377 | 2019-04-22 03:38:39 | [diff] [blame] | 824 | <h3 id="_git_transport">Git Transport</h3> |
Junio C Hamano | ccb8252 | 2018-05-08 07:52:09 | [diff] [blame] | 825 | <div class="paragraph"><p>When using the git:// transport, you can request to use protocol v2 by |
| 826 | sending "version=2" as an extra parameter:</p></div> |
| 827 | <div class="literalblock"> |
| 828 | <div class="content"> |
| 829 | <pre><code>003egit-upload-pack /project.git\0host=myserver.com\0\0version=2\0</code></pre> |
| 830 | </div></div> |
| 831 | </div> |
| 832 | <div class="sect2"> |
Junio C Hamano | b551377 | 2019-04-22 03:38:39 | [diff] [blame] | 833 | <h3 id="_ssh_and_file_transport">SSH and File Transport</h3> |
Junio C Hamano | ccb8252 | 2018-05-08 07:52:09 | [diff] [blame] | 834 | <div class="paragraph"><p>When using either the ssh:// or file:// transport, the GIT_PROTOCOL |
| 835 | environment variable must be set explicitly to include "version=2".</p></div> |
| 836 | </div> |
| 837 | <div class="sect2"> |
Junio C Hamano | b551377 | 2019-04-22 03:38:39 | [diff] [blame] | 838 | <h3 id="_http_transport">HTTP Transport</h3> |
Junio C Hamano | ccb8252 | 2018-05-08 07:52:09 | [diff] [blame] | 839 | <div class="paragraph"><p>When using the http:// or https:// transport a client makes a "smart" |
| 840 | info/refs request as described in <code>http-protocol.txt</code> and requests that |
| 841 | v2 be used by supplying "version=2" in the <code>Git-Protocol</code> header.</p></div> |
| 842 | <div class="literalblock"> |
| 843 | <div class="content"> |
Junio C Hamano | ea1ac8d | 2018-07-18 20:16:48 | [diff] [blame] | 844 | <pre><code>C: GET $GIT_URL/info/refs?service=git-upload-pack HTTP/1.0 |
| 845 | C: Git-Protocol: version=2</code></pre> |
Junio C Hamano | ccb8252 | 2018-05-08 07:52:09 | [diff] [blame] | 846 | </div></div> |
| 847 | <div class="paragraph"><p>A v2 server would reply:</p></div> |
| 848 | <div class="literalblock"> |
| 849 | <div class="content"> |
| 850 | <pre><code>S: 200 OK |
| 851 | S: <Some headers> |
| 852 | S: ... |
| 853 | S: |
| 854 | S: 000eversion 2\n |
| 855 | S: <capability-advertisement></code></pre> |
| 856 | </div></div> |
| 857 | <div class="paragraph"><p>Subsequent requests are then made directly to the service |
| 858 | <code>$GIT_URL/git-upload-pack</code>. (This works the same for git-receive-pack).</p></div> |
Junio C Hamano | de44de3 | 2021-09-20 22:46:08 | [diff] [blame^] | 859 | <div class="paragraph"><p>Uses the <code>--http-backend-info-refs</code> option to |
| 860 | <a href="../git-upload-pack.html">git-upload-pack(1)</a>.</p></div> |
Junio C Hamano | ccb8252 | 2018-05-08 07:52:09 | [diff] [blame] | 861 | </div> |
| 862 | </div> |
| 863 | </div> |
| 864 | <div class="sect1"> |
Junio C Hamano | b551377 | 2019-04-22 03:38:39 | [diff] [blame] | 865 | <h2 id="_capability_advertisement">Capability Advertisement</h2> |
Junio C Hamano | ccb8252 | 2018-05-08 07:52:09 | [diff] [blame] | 866 | <div class="sectionbody"> |
| 867 | <div class="paragraph"><p>A server which decides to communicate (based on a request from a client) |
| 868 | using protocol version 2, notifies the client by sending a version string |
| 869 | in its initial response followed by an advertisement of its capabilities. |
| 870 | Each capability is a key with an optional value. Clients must ignore all |
| 871 | unknown keys. Semantics of unknown values are left to the definition of |
| 872 | each key. Some capabilities will describe commands which can be requested |
| 873 | to be executed by the client.</p></div> |
| 874 | <div class="literalblock"> |
| 875 | <div class="content"> |
| 876 | <pre><code>capability-advertisement = protocol-version |
| 877 | capability-list |
| 878 | flush-pkt</code></pre> |
| 879 | </div></div> |
| 880 | <div class="literalblock"> |
| 881 | <div class="content"> |
| 882 | <pre><code>protocol-version = PKT-LINE("version 2" LF) |
| 883 | capability-list = *capability |
| 884 | capability = PKT-LINE(key[=value] LF)</code></pre> |
| 885 | </div></div> |
| 886 | <div class="literalblock"> |
| 887 | <div class="content"> |
| 888 | <pre><code>key = 1*(ALPHA | DIGIT | "-_") |
| 889 | value = 1*(ALPHA | DIGIT | " -_.,?\/{}[]()<>!@#$%^&*+=:;")</code></pre> |
| 890 | </div></div> |
| 891 | </div> |
| 892 | </div> |
| 893 | <div class="sect1"> |
Junio C Hamano | b551377 | 2019-04-22 03:38:39 | [diff] [blame] | 894 | <h2 id="_command_request">Command Request</h2> |
Junio C Hamano | ccb8252 | 2018-05-08 07:52:09 | [diff] [blame] | 895 | <div class="sectionbody"> |
| 896 | <div class="paragraph"><p>After receiving the capability advertisement, a client can then issue a |
| 897 | request to select the command it wants with any particular capabilities |
| 898 | or arguments. There is then an optional section where the client can |
| 899 | provide any command specific parameters or queries. Only a single |
| 900 | command can be requested at a time.</p></div> |
| 901 | <div class="literalblock"> |
| 902 | <div class="content"> |
| 903 | <pre><code>request = empty-request | command-request |
| 904 | empty-request = flush-pkt |
| 905 | command-request = command |
| 906 | capability-list |
| 907 | [command-args] |
| 908 | flush-pkt |
| 909 | command = PKT-LINE("command=" key LF) |
| 910 | command-args = delim-pkt |
| 911 | *command-specific-arg</code></pre> |
| 912 | </div></div> |
| 913 | <div class="literalblock"> |
| 914 | <div class="content"> |
| 915 | <pre><code>command-specific-args are packet line framed arguments defined by |
| 916 | each individual command.</code></pre> |
| 917 | </div></div> |
| 918 | <div class="paragraph"><p>The server will then check to ensure that the client’s request is |
| 919 | comprised of a valid command as well as valid capabilities which were |
| 920 | advertised. If the request is valid the server will then execute the |
| 921 | command. A server MUST wait till it has received the client’s entire |
| 922 | request before issuing a response. The format of the response is |
| 923 | determined by the command being executed, but in all cases a flush-pkt |
| 924 | indicates the end of the response.</p></div> |
| 925 | <div class="paragraph"><p>When a command has finished, and the client has received the entire |
| 926 | response from the server, a client can either request that another |
| 927 | command be executed or can terminate the connection. A client may |
| 928 | optionally send an empty request consisting of just a flush-pkt to |
| 929 | indicate that no more requests will be made.</p></div> |
| 930 | </div> |
| 931 | </div> |
| 932 | <div class="sect1"> |
Junio C Hamano | b551377 | 2019-04-22 03:38:39 | [diff] [blame] | 933 | <h2 id="_capabilities">Capabilities</h2> |
Junio C Hamano | ccb8252 | 2018-05-08 07:52:09 | [diff] [blame] | 934 | <div class="sectionbody"> |
| 935 | <div class="paragraph"><p>There are two different types of capabilities: normal capabilities, |
Junio C Hamano | 556b57e | 2019-08-12 17:46:38 | [diff] [blame] | 936 | which can be used to convey information or alter the behavior of a |
Junio C Hamano | ccb8252 | 2018-05-08 07:52:09 | [diff] [blame] | 937 | request, and commands, which are the core actions that a client wants to |
| 938 | perform (fetch, push, etc).</p></div> |
| 939 | <div class="paragraph"><p>Protocol version 2 is stateless by default. This means that all commands |
| 940 | must only last a single round and be stateless from the perspective of the |
| 941 | server side, unless the client has requested a capability indicating that |
| 942 | state should be maintained by the server. Clients MUST NOT require state |
| 943 | management on the server side in order to function correctly. This |
| 944 | permits simple round-robin load-balancing on the server side, without |
| 945 | needing to worry about state management.</p></div> |
| 946 | <div class="sect2"> |
Junio C Hamano | b551377 | 2019-04-22 03:38:39 | [diff] [blame] | 947 | <h3 id="_agent">agent</h3> |
Junio C Hamano | ccb8252 | 2018-05-08 07:52:09 | [diff] [blame] | 948 | <div class="paragraph"><p>The server can advertise the <code>agent</code> capability with a value <code>X</code> (in the |
| 949 | form <code>agent=X</code>) to notify the client that the server is running version |
| 950 | <code>X</code>. The client may optionally send its own agent string by including |
| 951 | the <code>agent</code> capability with a value <code>Y</code> (in the form <code>agent=Y</code>) in its |
| 952 | request to the server (but it MUST NOT do so if the server did not |
| 953 | advertise the agent capability). The <code>X</code> and <code>Y</code> strings may contain any |
| 954 | printable ASCII characters except space (i.e., the byte range 32 < x < |
| 955 | 127), and are typically of the form "package/version" (e.g., |
| 956 | "git/1.8.3.1"). The agent strings are purely informative for statistics |
| 957 | and debugging purposes, and MUST NOT be used to programmatically assume |
| 958 | the presence or absence of particular features.</p></div> |
| 959 | </div> |
| 960 | <div class="sect2"> |
Junio C Hamano | b551377 | 2019-04-22 03:38:39 | [diff] [blame] | 961 | <h3 id="_ls_refs">ls-refs</h3> |
Junio C Hamano | ccb8252 | 2018-05-08 07:52:09 | [diff] [blame] | 962 | <div class="paragraph"><p><code>ls-refs</code> is the command used to request a reference advertisement in v2. |
| 963 | Unlike the current reference advertisement, ls-refs takes in arguments |
| 964 | which can be used to limit the refs sent from the server.</p></div> |
| 965 | <div class="paragraph"><p>Additional features not supported in the base command will be advertised |
| 966 | as the value of the command in the capability advertisement in the form |
| 967 | of a space separated list of features: "<command>=<feature 1> <feature 2>"</p></div> |
| 968 | <div class="paragraph"><p>ls-refs takes in the following arguments:</p></div> |
| 969 | <div class="literalblock"> |
| 970 | <div class="content"> |
| 971 | <pre><code>symrefs |
| 972 | In addition to the object pointed by it, show the underlying ref |
| 973 | pointed by it when showing a symbolic ref. |
| 974 | peel |
| 975 | Show peeled tags. |
| 976 | ref-prefix <prefix> |
| 977 | When specified, only references having a prefix matching one of |
| 978 | the provided prefixes are displayed.</code></pre> |
| 979 | </div></div> |
Junio C Hamano | a70c988 | 2021-02-23 00:57:12 | [diff] [blame] | 980 | <div class="paragraph"><p>If the <em>unborn</em> feature is advertised the following argument can be |
| 981 | included in the client’s request.</p></div> |
| 982 | <div class="literalblock"> |
| 983 | <div class="content"> |
| 984 | <pre><code>unborn |
| 985 | The server will send information about HEAD even if it is a symref |
| 986 | pointing to an unborn branch in the form "unborn HEAD |
| 987 | symref-target:<target>".</code></pre> |
| 988 | </div></div> |
Junio C Hamano | ccb8252 | 2018-05-08 07:52:09 | [diff] [blame] | 989 | <div class="paragraph"><p>The output of ls-refs is as follows:</p></div> |
| 990 | <div class="literalblock"> |
| 991 | <div class="content"> |
| 992 | <pre><code>output = *ref |
| 993 | flush-pkt |
Junio C Hamano | a70c988 | 2021-02-23 00:57:12 | [diff] [blame] | 994 | obj-id-or-unborn = (obj-id | "unborn") |
| 995 | ref = PKT-LINE(obj-id-or-unborn SP refname *(SP ref-attribute) LF) |
Junio C Hamano | ccb8252 | 2018-05-08 07:52:09 | [diff] [blame] | 996 | ref-attribute = (symref | peeled) |
| 997 | symref = "symref-target:" symref-target |
| 998 | peeled = "peeled:" obj-id</code></pre> |
| 999 | </div></div> |
| 1000 | </div> |
| 1001 | <div class="sect2"> |
Junio C Hamano | b551377 | 2019-04-22 03:38:39 | [diff] [blame] | 1002 | <h3 id="_fetch">fetch</h3> |
Junio C Hamano | ccb8252 | 2018-05-08 07:52:09 | [diff] [blame] | 1003 | <div class="paragraph"><p><code>fetch</code> is the command used to fetch a packfile in v2. It can be looked |
| 1004 | at as a modified version of the v1 fetch where the ref-advertisement is |
| 1005 | stripped out (since the <code>ls-refs</code> command fills that role) and the |
| 1006 | message format is tweaked to eliminate redundancies and permit easy |
| 1007 | addition of future extensions.</p></div> |
| 1008 | <div class="paragraph"><p>Additional features not supported in the base command will be advertised |
| 1009 | as the value of the command in the capability advertisement in the form |
| 1010 | of a space separated list of features: "<command>=<feature 1> <feature 2>"</p></div> |
| 1011 | <div class="paragraph"><p>A <code>fetch</code> request can take the following arguments:</p></div> |
| 1012 | <div class="literalblock"> |
| 1013 | <div class="content"> |
| 1014 | <pre><code>want <oid> |
| 1015 | Indicates to the server an object which the client wants to |
| 1016 | retrieve. Wants can be anything and are not limited to |
| 1017 | advertised objects.</code></pre> |
| 1018 | </div></div> |
| 1019 | <div class="literalblock"> |
| 1020 | <div class="content"> |
| 1021 | <pre><code>have <oid> |
| 1022 | Indicates to the server an object which the client has locally. |
| 1023 | This allows the server to make a packfile which only contains |
| 1024 | the objects that the client needs. Multiple 'have' lines can be |
| 1025 | supplied.</code></pre> |
| 1026 | </div></div> |
| 1027 | <div class="literalblock"> |
| 1028 | <div class="content"> |
| 1029 | <pre><code>done |
| 1030 | Indicates to the server that negotiation should terminate (or |
| 1031 | not even begin if performing a clone) and that the server should |
| 1032 | use the information supplied in the request to construct the |
| 1033 | packfile.</code></pre> |
| 1034 | </div></div> |
| 1035 | <div class="literalblock"> |
| 1036 | <div class="content"> |
| 1037 | <pre><code>thin-pack |
| 1038 | Request that a thin pack be sent, which is a pack with deltas |
| 1039 | which reference base objects not contained within the pack (but |
| 1040 | are known to exist at the receiving end). This can reduce the |
| 1041 | network traffic significantly, but it requires the receiving end |
| 1042 | to know how to "thicken" these packs by adding the missing bases |
| 1043 | to the pack.</code></pre> |
| 1044 | </div></div> |
| 1045 | <div class="literalblock"> |
| 1046 | <div class="content"> |
| 1047 | <pre><code>no-progress |
| 1048 | Request that progress information that would normally be sent on |
| 1049 | side-band channel 2, during the packfile transfer, should not be |
| 1050 | sent. However, the side-band channel 3 is still used for error |
| 1051 | responses.</code></pre> |
| 1052 | </div></div> |
| 1053 | <div class="literalblock"> |
| 1054 | <div class="content"> |
| 1055 | <pre><code>include-tag |
| 1056 | Request that annotated tags should be sent if the objects they |
| 1057 | point to are being sent.</code></pre> |
| 1058 | </div></div> |
| 1059 | <div class="literalblock"> |
| 1060 | <div class="content"> |
| 1061 | <pre><code>ofs-delta |
| 1062 | Indicate that the client understands PACKv2 with delta referring |
| 1063 | to its base by position in pack rather than by an oid. That is, |
Junio C Hamano | 8ef91f3 | 2019-12-01 22:58:27 | [diff] [blame] | 1064 | they can read OBJ_OFS_DELTA (aka type 6) in a packfile.</code></pre> |
Junio C Hamano | ccb8252 | 2018-05-08 07:52:09 | [diff] [blame] | 1065 | </div></div> |
| 1066 | <div class="paragraph"><p>If the <em>shallow</em> feature is advertised the following arguments can be |
| 1067 | included in the clients request as well as the potential addition of the |
| 1068 | <em>shallow-info</em> section in the server’s response as explained below.</p></div> |
| 1069 | <div class="literalblock"> |
| 1070 | <div class="content"> |
| 1071 | <pre><code>shallow <oid> |
| 1072 | A client must notify the server of all commits for which it only |
| 1073 | has shallow copies (meaning that it doesn't have the parents of |
| 1074 | a commit) by supplying a 'shallow <oid>' line for each such |
| 1075 | object so that the server is aware of the limitations of the |
| 1076 | client's history. This is so that the server is aware that the |
| 1077 | client may not have all objects reachable from such commits.</code></pre> |
| 1078 | </div></div> |
| 1079 | <div class="literalblock"> |
| 1080 | <div class="content"> |
| 1081 | <pre><code>deepen <depth> |
| 1082 | Requests that the fetch/clone should be shallow having a commit |
| 1083 | depth of <depth> relative to the remote side.</code></pre> |
| 1084 | </div></div> |
| 1085 | <div class="literalblock"> |
| 1086 | <div class="content"> |
| 1087 | <pre><code>deepen-relative |
| 1088 | Requests that the semantics of the "deepen" command be changed |
| 1089 | to indicate that the depth requested is relative to the client's |
| 1090 | current shallow boundary, instead of relative to the requested |
| 1091 | commits.</code></pre> |
| 1092 | </div></div> |
| 1093 | <div class="literalblock"> |
| 1094 | <div class="content"> |
| 1095 | <pre><code>deepen-since <timestamp> |
| 1096 | Requests that the shallow clone/fetch should be cut at a |
| 1097 | specific time, instead of depth. Internally it's equivalent to |
| 1098 | doing "git rev-list --max-age=<timestamp>". Cannot be used with |
| 1099 | "deepen".</code></pre> |
| 1100 | </div></div> |
| 1101 | <div class="literalblock"> |
| 1102 | <div class="content"> |
| 1103 | <pre><code>deepen-not <rev> |
| 1104 | Requests that the shallow clone/fetch should be cut at a |
| 1105 | specific revision specified by '<rev>', instead of a depth. |
| 1106 | Internally it's equivalent of doing "git rev-list --not <rev>". |
| 1107 | Cannot be used with "deepen", but can be used with |
| 1108 | "deepen-since".</code></pre> |
| 1109 | </div></div> |
Junio C Hamano | 309465b | 2018-05-30 06:32:59 | [diff] [blame] | 1110 | <div class="paragraph"><p>If the <em>filter</em> feature is advertised, the following argument can be |
| 1111 | included in the client’s request:</p></div> |
| 1112 | <div class="literalblock"> |
| 1113 | <div class="content"> |
| 1114 | <pre><code>filter <filter-spec> |
| 1115 | Request that various objects from the packfile be omitted |
| 1116 | using one of several filtering techniques. These are intended |
| 1117 | for use with partial clone and partial fetch operations. See |
Junio C Hamano | 2567b32 | 2019-02-05 23:33:56 | [diff] [blame] | 1118 | `rev-list` for possible "filter-spec" values. When communicating |
| 1119 | with other processes, senders SHOULD translate scaled integers |
| 1120 | (e.g. "1k") into a fully-expanded form (e.g. "1024") to aid |
| 1121 | interoperability with older receivers that may not understand |
| 1122 | newly-invented scaling suffixes. However, receivers SHOULD |
| 1123 | accept the following suffixes: 'k', 'm', and 'g' for 1024, |
| 1124 | 1048576, and 1073741824, respectively.</code></pre> |
Junio C Hamano | 309465b | 2018-05-30 06:32:59 | [diff] [blame] | 1125 | </div></div> |
Junio C Hamano | 1ff0338 | 2018-07-25 22:10:48 | [diff] [blame] | 1126 | <div class="paragraph"><p>If the <em>ref-in-want</em> feature is advertised, the following argument can |
| 1127 | be included in the client’s request as well as the potential addition of |
| 1128 | the <em>wanted-refs</em> section in the server’s response as explained below.</p></div> |
| 1129 | <div class="literalblock"> |
| 1130 | <div class="content"> |
| 1131 | <pre><code>want-ref <ref> |
| 1132 | Indicates to the server that the client wants to retrieve a |
| 1133 | particular ref, where <ref> is the full name of a ref on the |
| 1134 | server.</code></pre> |
| 1135 | </div></div> |
Junio C Hamano | 2567b32 | 2019-02-05 23:33:56 | [diff] [blame] | 1136 | <div class="paragraph"><p>If the <em>sideband-all</em> feature is advertised, the following argument can be |
| 1137 | included in the client’s request:</p></div> |
| 1138 | <div class="literalblock"> |
| 1139 | <div class="content"> |
| 1140 | <pre><code>sideband-all |
| 1141 | Instruct the server to send the whole response multiplexed, not just |
| 1142 | the packfile section. All non-flush and non-delim PKT-LINE in the |
| 1143 | response (not only in the packfile section) will then start with a byte |
| 1144 | indicating its sideband (1, 2, or 3), and the server may send "0005\2" |
| 1145 | (a PKT-LINE of sideband 2 with no payload) as a keepalive packet.</code></pre> |
| 1146 | </div></div> |
Junio C Hamano | a5fefe3 | 2020-06-25 21:10:02 | [diff] [blame] | 1147 | <div class="paragraph"><p>If the <em>packfile-uris</em> feature is advertised, the following argument |
| 1148 | can be included in the client’s request as well as the potential |
| 1149 | addition of the <em>packfile-uris</em> section in the server’s response as |
| 1150 | explained below.</p></div> |
Junio C Hamano | ccb8252 | 2018-05-08 07:52:09 | [diff] [blame] | 1151 | <div class="literalblock"> |
| 1152 | <div class="content"> |
Junio C Hamano | a5fefe3 | 2020-06-25 21:10:02 | [diff] [blame] | 1153 | <pre><code>packfile-uris <comma-separated list of protocols> |
| 1154 | Indicates to the server that the client is willing to receive |
| 1155 | URIs of any of the given protocols in place of objects in the |
| 1156 | sent packfile. Before performing the connectivity check, the |
| 1157 | client should download from all given URIs. Currently, the |
| 1158 | protocols supported are "http" and "https".</code></pre> |
| 1159 | </div></div> |
Junio C Hamano | 608b11d | 2021-05-16 21:40:45 | [diff] [blame] | 1160 | <div class="paragraph"><p>If the <em>wait-for-done</em> feature is advertised, the following argument |
| 1161 | can be included in the client’s request.</p></div> |
| 1162 | <div class="literalblock"> |
| 1163 | <div class="content"> |
| 1164 | <pre><code>wait-for-done |
| 1165 | Indicates to the server that it should never send "ready", but |
| 1166 | should wait for the client to say "done" before sending the |
| 1167 | packfile.</code></pre> |
| 1168 | </div></div> |
Junio C Hamano | a5fefe3 | 2020-06-25 21:10:02 | [diff] [blame] | 1169 | <div class="paragraph"><p>The response of <code>fetch</code> is broken into a number of sections separated by |
| 1170 | delimiter packets (0001), with each section beginning with its section |
| 1171 | header. Most sections are sent only when the packfile is sent.</p></div> |
| 1172 | <div class="literalblock"> |
| 1173 | <div class="content"> |
| 1174 | <pre><code>output = acknowledgements flush-pkt | |
| 1175 | [acknowledgments delim-pkt] [shallow-info delim-pkt] |
| 1176 | [wanted-refs delim-pkt] [packfile-uris delim-pkt] |
| 1177 | packfile flush-pkt</code></pre> |
Junio C Hamano | ccb8252 | 2018-05-08 07:52:09 | [diff] [blame] | 1178 | </div></div> |
| 1179 | <div class="literalblock"> |
| 1180 | <div class="content"> |
| 1181 | <pre><code>acknowledgments = PKT-LINE("acknowledgments" LF) |
| 1182 | (nak | *ack) |
| 1183 | (ready) |
| 1184 | ready = PKT-LINE("ready" LF) |
| 1185 | nak = PKT-LINE("NAK" LF) |
| 1186 | ack = PKT-LINE("ACK" SP obj-id LF)</code></pre> |
| 1187 | </div></div> |
| 1188 | <div class="literalblock"> |
| 1189 | <div class="content"> |
| 1190 | <pre><code>shallow-info = PKT-LINE("shallow-info" LF) |
| 1191 | *PKT-LINE((shallow | unshallow) LF) |
| 1192 | shallow = "shallow" SP obj-id |
| 1193 | unshallow = "unshallow" SP obj-id</code></pre> |
| 1194 | </div></div> |
| 1195 | <div class="literalblock"> |
| 1196 | <div class="content"> |
Junio C Hamano | 1ff0338 | 2018-07-25 22:10:48 | [diff] [blame] | 1197 | <pre><code>wanted-refs = PKT-LINE("wanted-refs" LF) |
| 1198 | *PKT-LINE(wanted-ref LF) |
| 1199 | wanted-ref = obj-id SP refname</code></pre> |
| 1200 | </div></div> |
| 1201 | <div class="literalblock"> |
| 1202 | <div class="content"> |
Junio C Hamano | a5fefe3 | 2020-06-25 21:10:02 | [diff] [blame] | 1203 | <pre><code>packfile-uris = PKT-LINE("packfile-uris" LF) *packfile-uri |
| 1204 | packfile-uri = PKT-LINE(40*(HEXDIGIT) SP *%x20-ff LF)</code></pre> |
| 1205 | </div></div> |
| 1206 | <div class="literalblock"> |
| 1207 | <div class="content"> |
Junio C Hamano | ccb8252 | 2018-05-08 07:52:09 | [diff] [blame] | 1208 | <pre><code>packfile = PKT-LINE("packfile" LF) |
| 1209 | *PKT-LINE(%x01-03 *%x00-ff)</code></pre> |
| 1210 | </div></div> |
| 1211 | <div class="literalblock"> |
| 1212 | <div class="content"> |
| 1213 | <pre><code>acknowledgments section |
Junio C Hamano | a5fefe3 | 2020-06-25 21:10:02 | [diff] [blame] | 1214 | * If the client determines that it is finished with negotiations by |
| 1215 | sending a "done" line (thus requiring the server to send a packfile), |
| 1216 | the acknowledgments sections MUST be omitted from the server's |
| 1217 | response.</code></pre> |
Junio C Hamano | ccb8252 | 2018-05-08 07:52:09 | [diff] [blame] | 1218 | </div></div> |
| 1219 | <div class="ulist"><ul> |
| 1220 | <li> |
| 1221 | <p> |
| 1222 | Always begins with the section header "acknowledgments" |
| 1223 | </p> |
| 1224 | </li> |
| 1225 | <li> |
| 1226 | <p> |
| 1227 | The server will respond with "NAK" if none of the object ids sent |
| 1228 | as have lines were common. |
| 1229 | </p> |
| 1230 | </li> |
| 1231 | <li> |
| 1232 | <p> |
| 1233 | The server will respond with "ACK obj-id" for all of the |
| 1234 | object ids sent as have lines which are common. |
| 1235 | </p> |
| 1236 | </li> |
| 1237 | <li> |
| 1238 | <p> |
| 1239 | A response cannot have both "ACK" lines as well as a "NAK" |
| 1240 | line. |
| 1241 | </p> |
| 1242 | </li> |
| 1243 | <li> |
| 1244 | <p> |
| 1245 | The server will respond with a "ready" line indicating that |
| 1246 | the server has found an acceptable common base and is ready to |
| 1247 | make and send a packfile (which will be found in the packfile |
| 1248 | section of the same response) |
| 1249 | </p> |
| 1250 | </li> |
| 1251 | <li> |
| 1252 | <p> |
| 1253 | If the server has found a suitable cut point and has decided |
| 1254 | to send a "ready" line, then the server can decide to (as an |
| 1255 | optimization) omit any "ACK" lines it would have sent during |
| 1256 | its response. This is because the server will have already |
| 1257 | determined the objects it plans to send to the client and no |
| 1258 | further negotiation is needed. |
| 1259 | </p> |
| 1260 | <div class="literalblock"> |
| 1261 | <div class="content"> |
| 1262 | <pre><code>shallow-info section |
| 1263 | * If the client has requested a shallow fetch/clone, a shallow |
| 1264 | client requests a fetch or the server is shallow then the |
| 1265 | server's response may include a shallow-info section. The |
| 1266 | shallow-info section will be included if (due to one of the |
| 1267 | above conditions) the server needs to inform the client of any |
| 1268 | shallow boundaries or adjustments to the clients already |
| 1269 | existing shallow boundaries.</code></pre> |
| 1270 | </div></div> |
| 1271 | </li> |
| 1272 | <li> |
| 1273 | <p> |
| 1274 | Always begins with the section header "shallow-info" |
| 1275 | </p> |
| 1276 | </li> |
| 1277 | <li> |
| 1278 | <p> |
| 1279 | If a positive depth is requested, the server will compute the |
| 1280 | set of commits which are no deeper than the desired depth. |
| 1281 | </p> |
| 1282 | </li> |
| 1283 | <li> |
| 1284 | <p> |
| 1285 | The server sends a "shallow obj-id" line for each commit whose |
| 1286 | parents will not be sent in the following packfile. |
| 1287 | </p> |
| 1288 | </li> |
| 1289 | <li> |
| 1290 | <p> |
| 1291 | The server sends an "unshallow obj-id" line for each commit |
| 1292 | which the client has indicated is shallow, but is no longer |
| 1293 | shallow as a result of the fetch (due to its parents being |
| 1294 | sent in the following packfile). |
| 1295 | </p> |
| 1296 | </li> |
| 1297 | <li> |
| 1298 | <p> |
| 1299 | The server MUST NOT send any "unshallow" lines for anything |
| 1300 | which the client has not indicated was shallow as a part of |
| 1301 | its request. |
| 1302 | </p> |
Junio C Hamano | ccb8252 | 2018-05-08 07:52:09 | [diff] [blame] | 1303 | <div class="literalblock"> |
| 1304 | <div class="content"> |
Junio C Hamano | 1ff0338 | 2018-07-25 22:10:48 | [diff] [blame] | 1305 | <pre><code>wanted-refs section |
| 1306 | * This section is only included if the client has requested a |
| 1307 | ref using a 'want-ref' line and if a packfile section is also |
| 1308 | included in the response.</code></pre> |
| 1309 | </div></div> |
| 1310 | </li> |
| 1311 | <li> |
| 1312 | <p> |
| 1313 | Always begins with the section header "wanted-refs". |
| 1314 | </p> |
| 1315 | </li> |
| 1316 | <li> |
| 1317 | <p> |
| 1318 | The server will send a ref listing ("<oid> <refname>") for |
| 1319 | each reference requested using <em>want-ref</em> lines. |
| 1320 | </p> |
| 1321 | </li> |
| 1322 | <li> |
| 1323 | <p> |
| 1324 | The server MUST NOT send any refs which were not requested |
| 1325 | using <em>want-ref</em> lines. |
| 1326 | </p> |
| 1327 | <div class="literalblock"> |
| 1328 | <div class="content"> |
Junio C Hamano | a5fefe3 | 2020-06-25 21:10:02 | [diff] [blame] | 1329 | <pre><code>packfile-uris section |
| 1330 | * This section is only included if the client sent |
| 1331 | 'packfile-uris' and the server has at least one such URI to |
| 1332 | send.</code></pre> |
| 1333 | </div></div> |
| 1334 | </li> |
| 1335 | <li> |
| 1336 | <p> |
| 1337 | Always begins with the section header "packfile-uris". |
| 1338 | </p> |
| 1339 | </li> |
| 1340 | <li> |
| 1341 | <p> |
| 1342 | For each URI the server sends, it sends a hash of the pack’s |
| 1343 | contents (as output by git index-pack) followed by the URI. |
| 1344 | </p> |
| 1345 | </li> |
| 1346 | <li> |
| 1347 | <p> |
| 1348 | The hashes are 40 hex characters long. When Git upgrades to a new |
| 1349 | hash algorithm, this might need to be updated. (It should match |
| 1350 | whatever index-pack outputs after "pack\t" or "keep\t". |
| 1351 | </p> |
| 1352 | <div class="literalblock"> |
| 1353 | <div class="content"> |
Junio C Hamano | ccb8252 | 2018-05-08 07:52:09 | [diff] [blame] | 1354 | <pre><code>packfile section |
| 1355 | * This section is only included if the client has sent 'want' |
| 1356 | lines in its request and either requested that no more |
| 1357 | negotiation be done by sending 'done' or if the server has |
| 1358 | decided it has found a sufficient cut point to produce a |
| 1359 | packfile.</code></pre> |
| 1360 | </div></div> |
| 1361 | </li> |
| 1362 | <li> |
| 1363 | <p> |
| 1364 | Always begins with the section header "packfile" |
| 1365 | </p> |
| 1366 | </li> |
| 1367 | <li> |
| 1368 | <p> |
| 1369 | The transmission of the packfile begins immediately after the |
| 1370 | section header |
| 1371 | </p> |
| 1372 | </li> |
| 1373 | <li> |
| 1374 | <p> |
| 1375 | The data transfer of the packfile is always multiplexed, using |
| 1376 | the same semantics of the <em>side-band-64k</em> capability from |
| 1377 | protocol version 1. This means that each packet, during the |
| 1378 | packfile data stream, is made up of a leading 4-byte pkt-line |
| 1379 | length (typical of the pkt-line format), followed by a 1-byte |
| 1380 | stream code, followed by the actual data. |
| 1381 | </p> |
| 1382 | <div class="literalblock"> |
| 1383 | <div class="content"> |
| 1384 | <pre><code>The stream code can be one of: |
| 1385 | 1 - pack data |
| 1386 | 2 - progress messages |
| 1387 | 3 - fatal error message just before stream aborts</code></pre> |
| 1388 | </div></div> |
| 1389 | </li> |
| 1390 | </ul></div> |
| 1391 | </div> |
Junio C Hamano | b9d9d90 | 2018-05-23 07:07:42 | [diff] [blame] | 1392 | <div class="sect2"> |
Junio C Hamano | b551377 | 2019-04-22 03:38:39 | [diff] [blame] | 1393 | <h3 id="_server_option">server-option</h3> |
Junio C Hamano | b9d9d90 | 2018-05-23 07:07:42 | [diff] [blame] | 1394 | <div class="paragraph"><p>If advertised, indicates that any number of server specific options can be |
| 1395 | included in a request. This is done by sending each option as a |
| 1396 | "server-option=<option>" capability line in the capability-list section of |
| 1397 | a request.</p></div> |
| 1398 | <div class="paragraph"><p>The provided options must not contain a NUL or LF character.</p></div> |
| 1399 | </div> |
Junio C Hamano | a891178 | 2020-07-07 05:35:57 | [diff] [blame] | 1400 | <div class="sect2"> |
| 1401 | <h3 id="_object_format"> object-format</h3> |
| 1402 | <div class="paragraph"><p>The server can advertise the <code>object-format</code> capability with a value <code>X</code> (in the |
| 1403 | form <code>object-format=X</code>) to notify the client that the server is able to deal |
| 1404 | with objects using hash algorithm X. If not specified, the server is assumed to |
| 1405 | only handle SHA-1. If the client would like to use a hash algorithm other than |
| 1406 | SHA-1, it should specify its object-format string.</p></div> |
| 1407 | </div> |
Junio C Hamano | 992fbdc | 2020-12-09 00:14:29 | [diff] [blame] | 1408 | <div class="sect2"> |
| 1409 | <h3 id="_session_id_lt_session_id_gt">session-id=<session id></h3> |
| 1410 | <div class="paragraph"><p>The server may advertise a session ID that can be used to identify this process |
| 1411 | across multiple requests. The client may advertise its own session ID back to |
| 1412 | the server as well.</p></div> |
| 1413 | <div class="paragraph"><p>Session IDs should be unique to a given process. They must fit within a |
| 1414 | packet-line, and must not contain non-printable or whitespace characters. The |
| 1415 | current implementation uses trace2 session IDs (see |
| 1416 | <a href="api-trace2.html">api-trace2</a> for details), but this may change and users of |
| 1417 | the session ID should not rely on this fact.</p></div> |
| 1418 | </div> |
Junio C Hamano | 766021a | 2021-05-13 23:58:39 | [diff] [blame] | 1419 | <div class="sect2"> |
| 1420 | <h3 id="_object_info">object-info</h3> |
| 1421 | <div class="paragraph"><p><code>object-info</code> is the command to retrieve information about one or more objects. |
| 1422 | Its main purpose is to allow a client to make decisions based on this |
| 1423 | information without having to fully fetch objects. Object size is the only |
| 1424 | information that is currently supported.</p></div> |
| 1425 | <div class="paragraph"><p>An <code>object-info</code> request takes the following arguments:</p></div> |
| 1426 | <div class="literalblock"> |
| 1427 | <div class="content"> |
| 1428 | <pre><code>size |
| 1429 | Requests size information to be returned for each listed object id.</code></pre> |
| 1430 | </div></div> |
| 1431 | <div class="literalblock"> |
| 1432 | <div class="content"> |
| 1433 | <pre><code>oid <oid> |
| 1434 | Indicates to the server an object which the client wants to obtain |
| 1435 | information for.</code></pre> |
| 1436 | </div></div> |
Junio C Hamano | 91a411f | 2021-07-14 00:40:50 | [diff] [blame] | 1437 | <div class="paragraph"><p>The response of <code>object-info</code> is a list of the requested object ids |
Junio C Hamano | 766021a | 2021-05-13 23:58:39 | [diff] [blame] | 1438 | and associated requested information, each separated by a single space.</p></div> |
| 1439 | <div class="literalblock"> |
| 1440 | <div class="content"> |
| 1441 | <pre><code>output = info flush-pkt</code></pre> |
| 1442 | </div></div> |
| 1443 | <div class="literalblock"> |
| 1444 | <div class="content"> |
| 1445 | <pre><code>info = PKT-LINE(attrs) LF) |
| 1446 | *PKT-LINE(obj-info LF)</code></pre> |
| 1447 | </div></div> |
| 1448 | <div class="literalblock"> |
| 1449 | <div class="content"> |
| 1450 | <pre><code>attrs = attr | attrs SP attrs</code></pre> |
| 1451 | </div></div> |
| 1452 | <div class="literalblock"> |
| 1453 | <div class="content"> |
| 1454 | <pre><code>attr = "size"</code></pre> |
| 1455 | </div></div> |
| 1456 | <div class="literalblock"> |
| 1457 | <div class="content"> |
| 1458 | <pre><code>obj-info = obj-id SP obj-size</code></pre> |
| 1459 | </div></div> |
| 1460 | </div> |
Junio C Hamano | ccb8252 | 2018-05-08 07:52:09 | [diff] [blame] | 1461 | </div> |
| 1462 | </div> |
| 1463 | </div> |
| 1464 | <div id="footnotes"><hr /></div> |
| 1465 | <div id="footer"> |
| 1466 | <div id="footer-text"> |
| 1467 | Last updated |
Junio C Hamano | de44de3 | 2021-09-20 22:46:08 | [diff] [blame^] | 1468 | 2021-09-20 15:44:03 PDT |
Junio C Hamano | ccb8252 | 2018-05-08 07:52:09 | [diff] [blame] | 1469 | </div> |
| 1470 | </div> |
| 1471 | </body> |
| 1472 | </html> |