Autogenerated HTML docs for v2.44.0-248-g4f9b7
[git-htmldocs.git] / gitformat-index.html
blob558cf0e011264ccf0e8f12b301f3fd637ada3882
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" />
7 <meta name="generator" content="AsciiDoc 10.2.0" />
8 <title>gitformat-index(5)</title>
9 <style type="text/css">
10 /* Shared CSS for AsciiDoc xhtml11 and html5 backends */
12 /* Default font. */
13 body {
14 font-family: Georgia,serif;
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;
27 body {
28 margin: 1em 5% 1em 5%;
31 a {
32 color: blue;
33 text-decoration: underline;
35 a:visited {
36 color: fuchsia;
39 em {
40 font-style: italic;
41 color: navy;
44 strong {
45 font-weight: bold;
46 color: #083194;
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;
56 h1, h2, h3 {
57 border-bottom: 2px solid silver;
59 h2 {
60 padding-top: 0.5em;
62 h3 {
63 float: left;
65 h3 + * {
66 clear: left;
68 h5 {
69 font-size: 1.0em;
72 div.sectionbody {
73 margin-left: 0;
76 hr {
77 border: 1px solid silver;
80 p {
81 margin-top: 0.5em;
82 margin-bottom: 0.5em;
85 ul, ol, li > p {
86 margin-top: 0;
88 ul > li { color: #aaa; }
89 ul > li > * { color: black; }
91 .monospaced, code, pre {
92 font-family: "Courier New", Courier, monospace;
93 font-size: inherit;
94 color: navy;
95 padding: 0;
96 margin: 0;
98 pre {
99 white-space: pre-wrap;
102 #author {
103 color: #527bbd;
104 font-weight: bold;
105 font-size: 1.1em;
107 #email {
109 #revnumber, #revdate, #revremark {
112 #footer {
113 font-size: small;
114 border-top: 2px solid silver;
115 padding-top: 0.5em;
116 margin-top: 4.0em;
118 #footer-text {
119 float: left;
120 padding-bottom: 0.5em;
122 #footer-badges {
123 float: right;
124 padding-bottom: 0.5em;
127 #preamble {
128 margin-top: 1.5em;
129 margin-bottom: 1.5em;
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;
137 div.admonitionblock {
138 margin-top: 2.0em;
139 margin-bottom: 2.0em;
140 margin-right: 10%;
141 color: #606060;
144 div.content { /* Block element content. */
145 padding: 0;
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;
156 div.title + * {
157 margin-top: 0;
160 td div.title:first-child {
161 margin-top: 0.0em;
163 div.content div.title:first-child {
164 margin-top: 0.0em;
166 div.content + div.title {
167 margin-top: 0.0em;
170 div.sidebarblock > div.content {
171 background: #ffffee;
172 border: 1px solid #dddddd;
173 border-left: 4px solid #f0f0f0;
174 padding: 0.5em;
177 div.listingblock > div.content {
178 border: 1px solid #dddddd;
179 border-left: 5px solid #f0f0f0;
180 background: #f8f8f8;
181 padding: 0.5em;
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;
192 div.quoteblock > div.attribution {
193 padding-top: 0.5em;
194 text-align: right;
197 div.verseblock > pre.content {
198 font-family: inherit;
199 font-size: inherit;
201 div.verseblock > div.attribution {
202 padding-top: 0.75em;
203 text-align: left;
205 /* DEPRECATED: Pre version 8.2.7 verse style literal block. */
206 div.verseblock + div.attribution {
207 text-align: left;
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;
218 div.admonitionblock td.content {
219 padding-left: 0.5em;
220 border-left: 3px solid #dddddd;
223 div.exampleblock > div.content {
224 border-left: 3px solid #dddddd;
225 padding-left: 0.5em;
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; }
232 dl {
233 margin-top: 0.8em;
234 margin-bottom: 0.8em;
236 dt {
237 margin-top: 0.5em;
238 margin-bottom: 0;
239 font-style: normal;
240 color: navy;
242 dd > *:first-child {
243 margin-top: 0.1em;
246 ul, ol {
247 list-style-position: outside;
249 ol.arabic {
250 list-style-type: decimal;
252 ol.loweralpha {
253 list-style-type: lower-alpha;
255 ol.upperalpha {
256 list-style-type: upper-alpha;
258 ol.lowerroman {
259 list-style-type: lower-roman;
261 ol.upperroman {
262 list-style-type: upper-roman;
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;
272 tfoot {
273 font-weight: bold;
275 td > div.verse {
276 white-space: pre;
279 div.hdlist {
280 margin-top: 0.8em;
281 margin-bottom: 0.8em;
283 div.hdlist tr {
284 padding-bottom: 15px;
286 dt.hdlist1.strong, td.hdlist1.strong {
287 font-weight: bold;
289 td.hdlist1 {
290 vertical-align: top;
291 font-style: normal;
292 padding-right: 0.8em;
293 color: navy;
295 td.hdlist2 {
296 vertical-align: top;
298 div.hdlist.compact tr {
299 margin: 0;
300 padding-bottom: 0;
303 .comment {
304 background: yellow;
307 .footnote, .footnoteref {
308 font-size: 0.8em;
311 span.footnote, span.footnoteref {
312 vertical-align: super;
315 #footnotes {
316 margin: 20px 0 20px 0;
317 padding: 7px 0 0 0;
320 #footnotes div.footnote {
321 margin: 0 0 5px 0;
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;
334 div.colist td {
335 padding-right: 0.5em;
336 padding-bottom: 0.3em;
337 vertical-align: top;
339 div.colist td img {
340 margin-top: 0.3em;
343 @media print {
344 #footer-badges { display: none; }
347 #toc {
348 margin-bottom: 2.5em;
351 #toctitle {
352 color: #527bbd;
353 font-size: 1.1em;
354 font-weight: bold;
355 margin-top: 1.0em;
356 margin-bottom: 0.1em;
359 div.toclevel0, div.toclevel1, div.toclevel2, div.toclevel3, div.toclevel4 {
360 margin-top: 0;
361 margin-bottom: 0;
363 div.toclevel2 {
364 margin-left: 2em;
365 font-size: 0.9em;
367 div.toclevel3 {
368 margin-left: 4em;
369 font-size: 0.9em;
371 div.toclevel4 {
372 margin-left: 6em;
373 font-size: 0.9em;
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; }
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; }
410 span.big { font-size: 2em; }
411 span.small { font-size: 0.6em; }
413 span.underline { text-decoration: underline; }
414 span.overline { text-decoration: overline; }
415 span.line-through { text-decoration: line-through; }
417 div.unbreakable { page-break-inside: avoid; }
421 * xhtml11 specific
423 * */
425 div.tableblock {
426 margin-top: 1.0em;
427 margin-bottom: 1.5em;
429 div.tableblock > table {
430 border: 3px solid #527bbd;
432 thead, p.table.header {
433 font-weight: bold;
434 color: #527bbd;
436 p.table {
437 margin-top: 0;
439 /* Because the table frame attribute is overridden by CSS in most browsers. */
440 div.tableblock > table[frame="void"] {
441 border-style: none;
443 div.tableblock > table[frame="hsides"] {
444 border-left-style: none;
445 border-right-style: none;
447 div.tableblock > table[frame="vsides"] {
448 border-top-style: none;
449 border-bottom-style: none;
454 * html5 specific
456 * */
458 table.tableblock {
459 margin-top: 1.0em;
460 margin-bottom: 1.5em;
462 thead, p.tableblock.header {
463 font-weight: bold;
464 color: #527bbd;
466 p.tableblock {
467 margin-top: 0;
469 table.tableblock {
470 border-width: 3px;
471 border-spacing: 0px;
472 border-style: solid;
473 border-color: #527bbd;
474 border-collapse: collapse;
476 th.tableblock, td.tableblock {
477 border-width: 1px;
478 padding: 4px;
479 border-style: solid;
480 border-color: #527bbd;
483 table.tableblock.frame-topbot {
484 border-left-style: hidden;
485 border-right-style: hidden;
487 table.tableblock.frame-sides {
488 border-top-style: hidden;
489 border-bottom-style: hidden;
491 table.tableblock.frame-none {
492 border-style: hidden;
495 th.tableblock.halign-left, td.tableblock.halign-left {
496 text-align: left;
498 th.tableblock.halign-center, td.tableblock.halign-center {
499 text-align: center;
501 th.tableblock.halign-right, td.tableblock.halign-right {
502 text-align: right;
505 th.tableblock.valign-top, td.tableblock.valign-top {
506 vertical-align: top;
508 th.tableblock.valign-middle, td.tableblock.valign-middle {
509 vertical-align: middle;
511 th.tableblock.valign-bottom, td.tableblock.valign-bottom {
512 vertical-align: bottom;
517 * manpage specific
519 * */
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;
527 body.manpage h2 {
528 border-style: none;
530 body.manpage div.sectionbody {
531 margin-left: 3em;
534 @media print {
535 body.manpage div#toc { display: none; }
539 </style>
540 <script type="text/javascript">
541 /*<![CDATA[*/
542 var asciidoc = { // Namespace.
544 /////////////////////////////////////////////////////////////////////
545 // Table Of Contents generator
546 /////////////////////////////////////////////////////////////////////
548 /* Author: Mihai Bazon, September 2002
549 * http://students.infoiasi.ro/~mishoo
551 * Table Of Content generator
552 * Version: 0.4
554 * Feel free to use this script under the terms of the GNU General Public
555 * License, as long as you do not remove or alter this notice.
558 /* modified by Troy D. Hanson, September 2006. License: GPL */
559 /* modified by Stuart Rackham, 2006, 2009. License: GPL */
561 // toclevels = 1..4.
562 toc: function (toclevels) {
564 function getText(el) {
565 var text = "";
566 for (var i = el.firstChild; i != null; i = i.nextSibling) {
567 if (i.nodeType == 3 /* Node.TEXT_NODE */) // IE doesn't speak constants.
568 text += i.data;
569 else if (i.firstChild != null)
570 text += getText(i);
572 return text;
575 function TocEntry(el, text, toclevel) {
576 this.element = el;
577 this.text = text;
578 this.toclevel = toclevel;
581 function tocEntries(el, toclevels) {
582 var result = new Array;
583 var re = new RegExp('[hH]([1-'+(toclevels+1)+'])');
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);
594 iterate(i);
598 iterate(el);
599 return result;
602 var toc = document.getElementById("toc");
603 if (!toc) {
604 return;
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);
617 for (i = 0; i < tocEntriesToRemove.length; i++) {
618 toc.removeChild(tocEntriesToRemove[i]);
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);
635 if (entries.length == 0)
636 toc.parentNode.removeChild(toc);
640 /////////////////////////////////////////////////////////////////////
641 // Footnotes generator
642 /////////////////////////////////////////////////////////////////////
644 /* Based on footnote generation code from:
645 * http://www.brandspankingnew.net/archive/2005/07/format_footnote.html
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;
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);
661 for (i = 0; i < entriesToRemove.length; i++) {
662 noteholder.removeChild(entriesToRemove[i]);
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);
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;
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>]";
708 install: function(toclevels) {
709 var timerId;
711 function reinstall() {
712 asciidoc.footnotes();
713 if (toclevels) {
714 asciidoc.toc(toclevels);
718 function reinstallAndRemoveTimer() {
719 clearInterval(timerId);
720 reinstall();
723 timerId = setInterval(reinstall, 500);
724 if (document.addEventListener)
725 document.addEventListener("DOMContentLoaded", reinstallAndRemoveTimer, false);
726 else
727 window.onload = reinstallAndRemoveTimer;
731 asciidoc.install();
732 /*]]>*/
733 </script>
734 </head>
735 <body class="manpage">
736 <div id="header">
737 <h1>
738 gitformat-index(5) Manual Page
739 </h1>
740 <h2>NAME</h2>
741 <div class="sectionbody">
742 <p>gitformat-index -
743 Git index format
744 </p>
745 </div>
746 </div>
747 <div id="content">
748 <div class="sect1">
749 <h2 id="_synopsis">SYNOPSIS</h2>
750 <div class="sectionbody">
751 <div class="verseblock">
752 <pre class="content">$GIT_DIR/index</pre>
753 <div class="attribution">
754 </div></div>
755 </div>
756 </div>
757 <div class="sect1">
758 <h2 id="_description">DESCRIPTION</h2>
759 <div class="sectionbody">
760 <div class="paragraph"><p>Git index format</p></div>
761 </div>
762 </div>
763 <div class="sect1">
764 <h2 id="_the_git_index_file_has_the_following_format">The Git index file has the following format</h2>
765 <div class="sectionbody">
766 <div class="literalblock">
767 <div class="content">
768 <pre><code>All binary numbers are in network byte order.
769 In a repository using the traditional SHA-1, checksums and object IDs
770 (object names) mentioned below are all computed using SHA-1. Similarly,
771 in SHA-256 repositories, these values are computed using SHA-256.
772 Version 2 is described here unless stated otherwise.</code></pre>
773 </div></div>
774 <div class="ulist"><ul>
775 <li>
777 A 12-byte header consisting of
778 </p>
779 <div class="literalblock">
780 <div class="content">
781 <pre><code>4-byte signature:
782 The signature is { 'D', 'I', 'R', 'C' } (stands for "dircache")</code></pre>
783 </div></div>
784 <div class="literalblock">
785 <div class="content">
786 <pre><code>4-byte version number:
787 The current supported versions are 2, 3 and 4.</code></pre>
788 </div></div>
789 <div class="literalblock">
790 <div class="content">
791 <pre><code>32-bit number of index entries.</code></pre>
792 </div></div>
793 </li>
794 <li>
796 A number of sorted index entries (see below).
797 </p>
798 </li>
799 <li>
801 Extensions
802 </p>
803 <div class="literalblock">
804 <div class="content">
805 <pre><code>Extensions are identified by signature. Optional extensions can
806 be ignored if Git does not understand them.</code></pre>
807 </div></div>
808 <div class="literalblock">
809 <div class="content">
810 <pre><code>4-byte extension signature. If the first byte is 'A'..'Z' the
811 extension is optional and can be ignored.</code></pre>
812 </div></div>
813 <div class="literalblock">
814 <div class="content">
815 <pre><code>32-bit size of the extension</code></pre>
816 </div></div>
817 <div class="literalblock">
818 <div class="content">
819 <pre><code>Extension data</code></pre>
820 </div></div>
821 </li>
822 <li>
824 Hash checksum over the content of the index file before this checksum.
825 </p>
826 </li>
827 </ul></div>
828 </div>
829 </div>
830 <div class="sect1">
831 <h2 id="_index_entry">Index entry</h2>
832 <div class="sectionbody">
833 <div class="literalblock">
834 <div class="content">
835 <pre><code>Index entries are sorted in ascending order on the name field,
836 interpreted as a string of unsigned bytes (i.e. memcmp() order, no
837 localization, no special casing of directory separator '/'). Entries
838 with the same name are sorted by their stage field.</code></pre>
839 </div></div>
840 <div class="literalblock">
841 <div class="content">
842 <pre><code>An index entry typically represents a file. However, if sparse-checkout
843 is enabled in cone mode (`core.sparseCheckoutCone` is enabled) and the
844 `extensions.sparseIndex` extension is enabled, then the index may
845 contain entries for directories outside of the sparse-checkout definition.
846 These entries have mode `040000`, include the `SKIP_WORKTREE` bit, and
847 the path ends in a directory separator.</code></pre>
848 </div></div>
849 <div class="literalblock">
850 <div class="content">
851 <pre><code>32-bit ctime seconds, the last time a file's metadata changed
852 this is stat(2) data</code></pre>
853 </div></div>
854 <div class="literalblock">
855 <div class="content">
856 <pre><code>32-bit ctime nanosecond fractions
857 this is stat(2) data</code></pre>
858 </div></div>
859 <div class="literalblock">
860 <div class="content">
861 <pre><code>32-bit mtime seconds, the last time a file's data changed
862 this is stat(2) data</code></pre>
863 </div></div>
864 <div class="literalblock">
865 <div class="content">
866 <pre><code>32-bit mtime nanosecond fractions
867 this is stat(2) data</code></pre>
868 </div></div>
869 <div class="literalblock">
870 <div class="content">
871 <pre><code>32-bit dev
872 this is stat(2) data</code></pre>
873 </div></div>
874 <div class="literalblock">
875 <div class="content">
876 <pre><code>32-bit ino
877 this is stat(2) data</code></pre>
878 </div></div>
879 <div class="literalblock">
880 <div class="content">
881 <pre><code>32-bit mode, split into (high to low bits)</code></pre>
882 </div></div>
883 <div class="literalblock">
884 <div class="content">
885 <pre><code>16-bit unused, must be zero</code></pre>
886 </div></div>
887 <div class="literalblock">
888 <div class="content">
889 <pre><code>4-bit object type
890 valid values in binary are 1000 (regular file), 1010 (symbolic link)
891 and 1110 (gitlink)</code></pre>
892 </div></div>
893 <div class="literalblock">
894 <div class="content">
895 <pre><code>3-bit unused, must be zero</code></pre>
896 </div></div>
897 <div class="literalblock">
898 <div class="content">
899 <pre><code>9-bit unix permission. Only 0755 and 0644 are valid for regular files.
900 Symbolic links and gitlinks have value 0 in this field.</code></pre>
901 </div></div>
902 <div class="literalblock">
903 <div class="content">
904 <pre><code>32-bit uid
905 this is stat(2) data</code></pre>
906 </div></div>
907 <div class="literalblock">
908 <div class="content">
909 <pre><code>32-bit gid
910 this is stat(2) data</code></pre>
911 </div></div>
912 <div class="literalblock">
913 <div class="content">
914 <pre><code>32-bit file size
915 This is the on-disk size from stat(2), truncated to 32-bit.</code></pre>
916 </div></div>
917 <div class="literalblock">
918 <div class="content">
919 <pre><code>Object name for the represented object</code></pre>
920 </div></div>
921 <div class="literalblock">
922 <div class="content">
923 <pre><code>A 16-bit 'flags' field split into (high to low bits)</code></pre>
924 </div></div>
925 <div class="literalblock">
926 <div class="content">
927 <pre><code>1-bit assume-valid flag</code></pre>
928 </div></div>
929 <div class="literalblock">
930 <div class="content">
931 <pre><code>1-bit extended flag (must be zero in version 2)</code></pre>
932 </div></div>
933 <div class="literalblock">
934 <div class="content">
935 <pre><code>2-bit stage (during merge)</code></pre>
936 </div></div>
937 <div class="literalblock">
938 <div class="content">
939 <pre><code>12-bit name length if the length is less than 0xFFF; otherwise 0xFFF
940 is stored in this field.</code></pre>
941 </div></div>
942 <div class="literalblock">
943 <div class="content">
944 <pre><code>(Version 3 or later) A 16-bit field, only applicable if the
945 "extended flag" above is 1, split into (high to low bits).</code></pre>
946 </div></div>
947 <div class="literalblock">
948 <div class="content">
949 <pre><code>1-bit reserved for future</code></pre>
950 </div></div>
951 <div class="literalblock">
952 <div class="content">
953 <pre><code>1-bit skip-worktree flag (used by sparse checkout)</code></pre>
954 </div></div>
955 <div class="literalblock">
956 <div class="content">
957 <pre><code>1-bit intent-to-add flag (used by "git add -N")</code></pre>
958 </div></div>
959 <div class="literalblock">
960 <div class="content">
961 <pre><code>13-bit unused, must be zero</code></pre>
962 </div></div>
963 <div class="literalblock">
964 <div class="content">
965 <pre><code>Entry path name (variable length) relative to top level directory
966 (without leading slash). '/' is used as path separator. The special
967 path components ".", ".." and ".git" (without quotes) are disallowed.
968 Trailing slash is also disallowed.</code></pre>
969 </div></div>
970 <div class="literalblock">
971 <div class="content">
972 <pre><code>The exact encoding is undefined, but the '.' and '/' characters
973 are encoded in 7-bit ASCII and the encoding cannot contain a NUL
974 byte (iow, this is a UNIX pathname).</code></pre>
975 </div></div>
976 <div class="literalblock">
977 <div class="content">
978 <pre><code>(Version 4) In version 4, the entry path name is prefix-compressed
979 relative to the path name for the previous entry (the very first
980 entry is encoded as if the path name for the previous entry is an
981 empty string). At the beginning of an entry, an integer N in the
982 variable width encoding (the same encoding as the offset is encoded
983 for OFS_DELTA pack entries; see linkgit:gitformat-pack[5]) is stored, followed
984 by a NUL-terminated string S. Removing N bytes from the end of the
985 path name for the previous entry, and replacing it with the string S
986 yields the path name for this entry.</code></pre>
987 </div></div>
988 <div class="literalblock">
989 <div class="content">
990 <pre><code>1-8 nul bytes as necessary to pad the entry to a multiple of eight bytes
991 while keeping the name NUL-terminated.</code></pre>
992 </div></div>
993 <div class="literalblock">
994 <div class="content">
995 <pre><code>(Version 4) In version 4, the padding after the pathname does not
996 exist.</code></pre>
997 </div></div>
998 <div class="literalblock">
999 <div class="content">
1000 <pre><code>Interpretation of index entries in split index mode is completely
1001 different. See below for details.</code></pre>
1002 </div></div>
1003 </div>
1004 </div>
1005 <div class="sect1">
1006 <h2 id="_extensions">Extensions</h2>
1007 <div class="sectionbody">
1008 <div class="sect2">
1009 <h3 id="_cache_tree">Cache tree</h3>
1010 <div class="literalblock">
1011 <div class="content">
1012 <pre><code>Since the index does not record entries for directories, the cache
1013 entries cannot describe tree objects that already exist in the object
1014 database for regions of the index that are unchanged from an existing
1015 commit. The cache tree extension stores a recursive tree structure that
1016 describes the trees that already exist and completely match sections of
1017 the cache entries. This speeds up tree object generation from the index
1018 for a new commit by only computing the trees that are "new" to that
1019 commit. It also assists when comparing the index to another tree, such
1020 as `HEAD^{tree}`, since sections of the index can be skipped when a tree
1021 comparison demonstrates equality.</code></pre>
1022 </div></div>
1023 <div class="literalblock">
1024 <div class="content">
1025 <pre><code>The recursive tree structure uses nodes that store a number of cache
1026 entries, a list of subnodes, and an object ID (OID). The OID references
1027 the existing tree for that node, if it is known to exist. The subnodes
1028 correspond to subdirectories that themselves have cache tree nodes. The
1029 number of cache entries corresponds to the number of cache entries in
1030 the index that describe paths within that tree's directory.</code></pre>
1031 </div></div>
1032 <div class="literalblock">
1033 <div class="content">
1034 <pre><code>The extension tracks the full directory structure in the cache tree
1035 extension, but this is generally smaller than the full cache entry list.</code></pre>
1036 </div></div>
1037 <div class="literalblock">
1038 <div class="content">
1039 <pre><code>When a path is updated in index, Git invalidates all nodes of the
1040 recursive cache tree corresponding to the parent directories of that
1041 path. We store these tree nodes as being "invalid" by using "-1" as the
1042 number of cache entries. Invalid nodes still store a span of index
1043 entries, allowing Git to focus its efforts when reconstructing a full
1044 cache tree.</code></pre>
1045 </div></div>
1046 <div class="literalblock">
1047 <div class="content">
1048 <pre><code>The signature for this extension is { 'T', 'R', 'E', 'E' }.</code></pre>
1049 </div></div>
1050 <div class="literalblock">
1051 <div class="content">
1052 <pre><code>A series of entries fill the entire extension; each of which
1053 consists of:</code></pre>
1054 </div></div>
1055 <div class="ulist"><ul>
1056 <li>
1058 NUL-terminated path component (relative to its parent directory);
1059 </p>
1060 </li>
1061 <li>
1063 ASCII decimal number of entries in the index that is covered by the
1064 tree this entry represents (entry_count);
1065 </p>
1066 </li>
1067 <li>
1069 A space (ASCII 32);
1070 </p>
1071 </li>
1072 <li>
1074 ASCII decimal number that represents the number of subtrees this
1075 tree has;
1076 </p>
1077 </li>
1078 <li>
1080 A newline (ASCII 10); and
1081 </p>
1082 </li>
1083 <li>
1085 Object name for the object that would result from writing this span
1086 of index as a tree.
1087 </p>
1088 <div class="literalblock">
1089 <div class="content">
1090 <pre><code>An entry can be in an invalidated state and is represented by having
1091 a negative number in the entry_count field. In this case, there is no
1092 object name and the next entry starts immediately after the newline.
1093 When writing an invalid entry, -1 should always be used as entry_count.</code></pre>
1094 </div></div>
1095 <div class="literalblock">
1096 <div class="content">
1097 <pre><code>The entries are written out in the top-down, depth-first order. The
1098 first entry represents the root level of the repository, followed by the
1099 first subtree--let's call this A--of the root level (with its name
1100 relative to the root level), followed by the first subtree of A (with
1101 its name relative to A), and so on. The specified number of subtrees
1102 indicates when the current level of the recursive stack is complete.</code></pre>
1103 </div></div>
1104 </li>
1105 </ul></div>
1106 </div>
1107 <div class="sect2">
1108 <h3 id="_resolve_undo">Resolve undo</h3>
1109 <div class="literalblock">
1110 <div class="content">
1111 <pre><code>A conflict is represented in the index as a set of higher stage entries.
1112 When a conflict is resolved (e.g. with "git add path"), these higher
1113 stage entries will be removed and a stage-0 entry with proper resolution
1114 is added.</code></pre>
1115 </div></div>
1116 <div class="literalblock">
1117 <div class="content">
1118 <pre><code>When these higher stage entries are removed, they are saved in the
1119 resolve undo extension, so that conflicts can be recreated (e.g. with
1120 "git checkout -m"), in case users want to redo a conflict resolution
1121 from scratch.</code></pre>
1122 </div></div>
1123 <div class="literalblock">
1124 <div class="content">
1125 <pre><code>The signature for this extension is { 'R', 'E', 'U', 'C' }.</code></pre>
1126 </div></div>
1127 <div class="literalblock">
1128 <div class="content">
1129 <pre><code>A series of entries fill the entire extension; each of which
1130 consists of:</code></pre>
1131 </div></div>
1132 <div class="ulist"><ul>
1133 <li>
1135 NUL-terminated pathname the entry describes (relative to the root of
1136 the repository, i.e. full pathname);
1137 </p>
1138 </li>
1139 <li>
1141 Three NUL-terminated ASCII octal numbers, entry mode of entries in
1142 stage 1 to 3 (a missing stage is represented by "0" in this field);
1144 </p>
1145 </li>
1146 <li>
1148 At most three object names of the entry in stages from 1 to 3
1149 (nothing is written for a missing stage).
1150 </p>
1151 </li>
1152 </ul></div>
1153 </div>
1154 <div class="sect2">
1155 <h3 id="_split_index">Split index</h3>
1156 <div class="literalblock">
1157 <div class="content">
1158 <pre><code>In split index mode, the majority of index entries could be stored
1159 in a separate file. This extension records the changes to be made on
1160 top of that to produce the final index.</code></pre>
1161 </div></div>
1162 <div class="literalblock">
1163 <div class="content">
1164 <pre><code>The signature for this extension is { 'l', 'i', 'n', 'k' }.</code></pre>
1165 </div></div>
1166 <div class="literalblock">
1167 <div class="content">
1168 <pre><code>The extension consists of:</code></pre>
1169 </div></div>
1170 <div class="ulist"><ul>
1171 <li>
1173 Hash of the shared index file. The shared index file path
1174 is $GIT_DIR/sharedindex.&lt;hash&gt;. If all bits are zero, the
1175 index does not require a shared index file.
1176 </p>
1177 </li>
1178 <li>
1180 An ewah-encoded delete bitmap, each bit represents an entry in the
1181 shared index. If a bit is set, its corresponding entry in the
1182 shared index will be removed from the final index. Note, because
1183 a delete operation changes index entry positions, but we do need
1184 original positions in replace phase, it&#8217;s best to just mark
1185 entries for removal, then do a mass deletion after replacement.
1186 </p>
1187 </li>
1188 <li>
1190 An ewah-encoded replace bitmap, each bit represents an entry in
1191 the shared index. If a bit is set, its corresponding entry in the
1192 shared index will be replaced with an entry in this index
1193 file. All replaced entries are stored in sorted order in this
1194 index. The first "1" bit in the replace bitmap corresponds to the
1195 first index entry, the second "1" bit to the second entry and so
1196 on. Replaced entries may have empty path names to save space.
1197 </p>
1198 <div class="literalblock">
1199 <div class="content">
1200 <pre><code>The remaining index entries after replaced ones will be added to the
1201 final index. These added entries are also sorted by entry name then
1202 stage.</code></pre>
1203 </div></div>
1204 </li>
1205 </ul></div>
1206 </div>
1207 </div>
1208 </div>
1209 <div class="sect1">
1210 <h2 id="_untracked_cache">Untracked cache</h2>
1211 <div class="sectionbody">
1212 <div class="literalblock">
1213 <div class="content">
1214 <pre><code>Untracked cache saves the untracked file list and necessary data to
1215 verify the cache. The signature for this extension is { 'U', 'N',
1216 'T', 'R' }.</code></pre>
1217 </div></div>
1218 <div class="literalblock">
1219 <div class="content">
1220 <pre><code>The extension starts with</code></pre>
1221 </div></div>
1222 <div class="ulist"><ul>
1223 <li>
1225 A sequence of NUL-terminated strings, preceded by the size of the
1226 sequence in variable width encoding. Each string describes the
1227 environment where the cache can be used.
1228 </p>
1229 </li>
1230 <li>
1232 Stat data of $GIT_DIR/info/exclude. See "Index entry" section from
1233 ctime field until "file size".
1234 </p>
1235 </li>
1236 <li>
1238 Stat data of core.excludesFile
1239 </p>
1240 </li>
1241 <li>
1243 32-bit dir_flags (see struct dir_struct)
1244 </p>
1245 </li>
1246 <li>
1248 Hash of $GIT_DIR/info/exclude. A null hash means the file
1249 does not exist.
1250 </p>
1251 </li>
1252 <li>
1254 Hash of core.excludesFile. A null hash means the file does
1255 not exist.
1256 </p>
1257 </li>
1258 <li>
1260 NUL-terminated string of per-dir exclude file name. This usually
1261 is ".gitignore".
1262 </p>
1263 </li>
1264 <li>
1266 The number of following directory blocks, variable width
1267 encoding. If this number is zero, the extension ends here with a
1268 following NUL.
1269 </p>
1270 </li>
1271 <li>
1273 A number of directory blocks in depth-first-search order, each
1274 consists of
1275 </p>
1276 </li>
1277 <li>
1279 The number of untracked entries, variable width encoding.
1280 </p>
1281 </li>
1282 <li>
1284 The number of sub-directory blocks, variable width encoding.
1285 </p>
1286 </li>
1287 <li>
1289 The directory name terminated by NUL.
1290 </p>
1291 </li>
1292 <li>
1294 A number of untracked file/dir names terminated by NUL.
1295 </p>
1296 </li>
1297 </ul></div>
1298 <div class="paragraph"><p>The remaining data of each directory block is grouped by type:</p></div>
1299 <div class="ulist"><ul>
1300 <li>
1302 An ewah bitmap, the n-th bit marks whether the n-th directory has
1303 valid untracked cache entries.
1304 </p>
1305 </li>
1306 <li>
1308 An ewah bitmap, the n-th bit records "check-only" bit of
1309 read_directory_recursive() for the n-th directory.
1310 </p>
1311 </li>
1312 <li>
1314 An ewah bitmap, the n-th bit indicates whether hash and stat data
1315 is valid for the n-th directory and exists in the next data.
1316 </p>
1317 </li>
1318 <li>
1320 An array of stat data. The n-th data corresponds with the n-th
1321 "one" bit in the previous ewah bitmap.
1322 </p>
1323 </li>
1324 <li>
1326 An array of hashes. The n-th hash corresponds with the n-th "one" bit
1327 in the previous ewah bitmap.
1328 </p>
1329 </li>
1330 <li>
1332 One NUL.
1333 </p>
1334 </li>
1335 </ul></div>
1336 </div>
1337 </div>
1338 <div class="sect1">
1339 <h2 id="_file_system_monitor_cache">File System Monitor cache</h2>
1340 <div class="sectionbody">
1341 <div class="literalblock">
1342 <div class="content">
1343 <pre><code>The file system monitor cache tracks files for which the core.fsmonitor
1344 hook has told us about changes. The signature for this extension is
1345 { 'F', 'S', 'M', 'N' }.</code></pre>
1346 </div></div>
1347 <div class="literalblock">
1348 <div class="content">
1349 <pre><code>The extension starts with</code></pre>
1350 </div></div>
1351 <div class="ulist"><ul>
1352 <li>
1354 32-bit version number: the current supported versions are 1 and 2.
1355 </p>
1356 </li>
1357 <li>
1359 (Version 1)
1360 64-bit time: the extension data reflects all changes through the given
1361 time which is stored as the nanoseconds elapsed since midnight,
1362 January 1, 1970.
1363 </p>
1364 </li>
1365 <li>
1367 (Version 2)
1368 A null terminated string: an opaque token defined by the file system
1369 monitor application. The extension data reflects all changes relative
1370 to that token.
1371 </p>
1372 </li>
1373 <li>
1375 32-bit bitmap size: the size of the CE_FSMONITOR_VALID bitmap.
1376 </p>
1377 </li>
1378 <li>
1380 An ewah bitmap, the n-th bit indicates whether the n-th index entry
1381 is not CE_FSMONITOR_VALID.
1382 </p>
1383 </li>
1384 </ul></div>
1385 </div>
1386 </div>
1387 <div class="sect1">
1388 <h2 id="_end_of_index_entry">End of Index Entry</h2>
1389 <div class="sectionbody">
1390 <div class="literalblock">
1391 <div class="content">
1392 <pre><code>The End of Index Entry (EOIE) is used to locate the end of the variable
1393 length index entries and the beginning of the extensions. Code can take
1394 advantage of this to quickly locate the index extensions without having
1395 to parse through all of the index entries.</code></pre>
1396 </div></div>
1397 <div class="literalblock">
1398 <div class="content">
1399 <pre><code>Because it must be able to be loaded before the variable length cache
1400 entries and other index extensions, this extension must be written last.
1401 The signature for this extension is { 'E', 'O', 'I', 'E' }.</code></pre>
1402 </div></div>
1403 <div class="literalblock">
1404 <div class="content">
1405 <pre><code>The extension consists of:</code></pre>
1406 </div></div>
1407 <div class="ulist"><ul>
1408 <li>
1410 32-bit offset to the end of the index entries
1411 </p>
1412 </li>
1413 <li>
1415 Hash over the extension types and their sizes (but not
1416 their contents). E.g. if we have "TREE" extension that is N-bytes
1417 long, "REUC" extension that is M-bytes long, followed by "EOIE",
1418 then the hash would be:
1419 </p>
1420 <div class="literalblock">
1421 <div class="content">
1422 <pre><code>Hash("TREE" + &lt;binary-representation-of-N&gt; +
1423 "REUC" + &lt;binary-representation-of-M&gt;)</code></pre>
1424 </div></div>
1425 </li>
1426 </ul></div>
1427 </div>
1428 </div>
1429 <div class="sect1">
1430 <h2 id="_index_entry_offset_table">Index Entry Offset Table</h2>
1431 <div class="sectionbody">
1432 <div class="literalblock">
1433 <div class="content">
1434 <pre><code>The Index Entry Offset Table (IEOT) is used to help address the CPU
1435 cost of loading the index by enabling multi-threading the process of
1436 converting cache entries from the on-disk format to the in-memory format.
1437 The signature for this extension is { 'I', 'E', 'O', 'T' }.</code></pre>
1438 </div></div>
1439 <div class="literalblock">
1440 <div class="content">
1441 <pre><code>The extension consists of:</code></pre>
1442 </div></div>
1443 <div class="ulist"><ul>
1444 <li>
1446 32-bit version (currently 1)
1447 </p>
1448 </li>
1449 <li>
1451 A number of index offset entries each consisting of:
1452 </p>
1453 </li>
1454 <li>
1456 32-bit offset from the beginning of the file to the first cache entry
1457 in this block of entries.
1458 </p>
1459 </li>
1460 <li>
1462 32-bit count of cache entries in this block
1463 </p>
1464 </li>
1465 </ul></div>
1466 </div>
1467 </div>
1468 <div class="sect1">
1469 <h2 id="_sparse_directory_entries">Sparse Directory Entries</h2>
1470 <div class="sectionbody">
1471 <div class="literalblock">
1472 <div class="content">
1473 <pre><code>When using sparse-checkout in cone mode, some entire directories within
1474 the index can be summarized by pointing to a tree object instead of the
1475 entire expanded list of paths within that tree. An index containing such
1476 entries is a "sparse index". Index format versions 4 and less were not
1477 implemented with such entries in mind. Thus, for these versions, an
1478 index containing sparse directory entries will include this extension
1479 with signature { 's', 'd', 'i', 'r' }. Like the split-index extension,
1480 tools should avoid interacting with a sparse index unless they understand
1481 this extension.</code></pre>
1482 </div></div>
1483 </div>
1484 </div>
1485 <div class="sect1">
1486 <h2 id="_git">GIT</h2>
1487 <div class="sectionbody">
1488 <div class="paragraph"><p>Part of the <a href="git.html">git(1)</a> suite</p></div>
1489 </div>
1490 </div>
1491 </div>
1492 <div id="footnotes"><hr /></div>
1493 <div id="footer">
1494 <div id="footer-text">
1495 Last updated
1496 2024-02-08 15:45:59 PST
1497 </div>
1498 </div>
1499 </body>
1500 </html>