Autogenerated HTML docs for v2.38.1-119-g9c32c
[git-htmldocs.git] / gitformat-index.html
blobc8b0a684eb1f6bb5669268b20505768cd0553235
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>4-bit object type
886 valid values in binary are 1000 (regular file), 1010 (symbolic link)
887 and 1110 (gitlink)</code></pre>
888 </div></div>
889 <div class="literalblock">
890 <div class="content">
891 <pre><code>3-bit unused</code></pre>
892 </div></div>
893 <div class="literalblock">
894 <div class="content">
895 <pre><code>9-bit unix permission. Only 0755 and 0644 are valid for regular files.
896 Symbolic links and gitlinks have value 0 in this field.</code></pre>
897 </div></div>
898 <div class="literalblock">
899 <div class="content">
900 <pre><code>32-bit uid
901 this is stat(2) data</code></pre>
902 </div></div>
903 <div class="literalblock">
904 <div class="content">
905 <pre><code>32-bit gid
906 this is stat(2) data</code></pre>
907 </div></div>
908 <div class="literalblock">
909 <div class="content">
910 <pre><code>32-bit file size
911 This is the on-disk size from stat(2), truncated to 32-bit.</code></pre>
912 </div></div>
913 <div class="literalblock">
914 <div class="content">
915 <pre><code>Object name for the represented object</code></pre>
916 </div></div>
917 <div class="literalblock">
918 <div class="content">
919 <pre><code>A 16-bit 'flags' field split into (high to low bits)</code></pre>
920 </div></div>
921 <div class="literalblock">
922 <div class="content">
923 <pre><code>1-bit assume-valid flag</code></pre>
924 </div></div>
925 <div class="literalblock">
926 <div class="content">
927 <pre><code>1-bit extended flag (must be zero in version 2)</code></pre>
928 </div></div>
929 <div class="literalblock">
930 <div class="content">
931 <pre><code>2-bit stage (during merge)</code></pre>
932 </div></div>
933 <div class="literalblock">
934 <div class="content">
935 <pre><code>12-bit name length if the length is less than 0xFFF; otherwise 0xFFF
936 is stored in this field.</code></pre>
937 </div></div>
938 <div class="literalblock">
939 <div class="content">
940 <pre><code>(Version 3 or later) A 16-bit field, only applicable if the
941 "extended flag" above is 1, split into (high to low bits).</code></pre>
942 </div></div>
943 <div class="literalblock">
944 <div class="content">
945 <pre><code>1-bit reserved for future</code></pre>
946 </div></div>
947 <div class="literalblock">
948 <div class="content">
949 <pre><code>1-bit skip-worktree flag (used by sparse checkout)</code></pre>
950 </div></div>
951 <div class="literalblock">
952 <div class="content">
953 <pre><code>1-bit intent-to-add flag (used by "git add -N")</code></pre>
954 </div></div>
955 <div class="literalblock">
956 <div class="content">
957 <pre><code>13-bit unused, must be zero</code></pre>
958 </div></div>
959 <div class="literalblock">
960 <div class="content">
961 <pre><code>Entry path name (variable length) relative to top level directory
962 (without leading slash). '/' is used as path separator. The special
963 path components ".", ".." and ".git" (without quotes) are disallowed.
964 Trailing slash is also disallowed.</code></pre>
965 </div></div>
966 <div class="literalblock">
967 <div class="content">
968 <pre><code>The exact encoding is undefined, but the '.' and '/' characters
969 are encoded in 7-bit ASCII and the encoding cannot contain a NUL
970 byte (iow, this is a UNIX pathname).</code></pre>
971 </div></div>
972 <div class="literalblock">
973 <div class="content">
974 <pre><code>(Version 4) In version 4, the entry path name is prefix-compressed
975 relative to the path name for the previous entry (the very first
976 entry is encoded as if the path name for the previous entry is an
977 empty string). At the beginning of an entry, an integer N in the
978 variable width encoding (the same encoding as the offset is encoded
979 for OFS_DELTA pack entries; see linkgit:gitformat-pack[5]) is stored, followed
980 by a NUL-terminated string S. Removing N bytes from the end of the
981 path name for the previous entry, and replacing it with the string S
982 yields the path name for this entry.</code></pre>
983 </div></div>
984 <div class="literalblock">
985 <div class="content">
986 <pre><code>1-8 nul bytes as necessary to pad the entry to a multiple of eight bytes
987 while keeping the name NUL-terminated.</code></pre>
988 </div></div>
989 <div class="literalblock">
990 <div class="content">
991 <pre><code>(Version 4) In version 4, the padding after the pathname does not
992 exist.</code></pre>
993 </div></div>
994 <div class="literalblock">
995 <div class="content">
996 <pre><code>Interpretation of index entries in split index mode is completely
997 different. See below for details.</code></pre>
998 </div></div>
999 </div>
1000 </div>
1001 <div class="sect1">
1002 <h2 id="_extensions">Extensions</h2>
1003 <div class="sectionbody">
1004 <div class="sect2">
1005 <h3 id="_cache_tree">Cache tree</h3>
1006 <div class="literalblock">
1007 <div class="content">
1008 <pre><code>Since the index does not record entries for directories, the cache
1009 entries cannot describe tree objects that already exist in the object
1010 database for regions of the index that are unchanged from an existing
1011 commit. The cache tree extension stores a recursive tree structure that
1012 describes the trees that already exist and completely match sections of
1013 the cache entries. This speeds up tree object generation from the index
1014 for a new commit by only computing the trees that are "new" to that
1015 commit. It also assists when comparing the index to another tree, such
1016 as `HEAD^{tree}`, since sections of the index can be skipped when a tree
1017 comparison demonstrates equality.</code></pre>
1018 </div></div>
1019 <div class="literalblock">
1020 <div class="content">
1021 <pre><code>The recursive tree structure uses nodes that store a number of cache
1022 entries, a list of subnodes, and an object ID (OID). The OID references
1023 the existing tree for that node, if it is known to exist. The subnodes
1024 correspond to subdirectories that themselves have cache tree nodes. The
1025 number of cache entries corresponds to the number of cache entries in
1026 the index that describe paths within that tree's directory.</code></pre>
1027 </div></div>
1028 <div class="literalblock">
1029 <div class="content">
1030 <pre><code>The extension tracks the full directory structure in the cache tree
1031 extension, but this is generally smaller than the full cache entry list.</code></pre>
1032 </div></div>
1033 <div class="literalblock">
1034 <div class="content">
1035 <pre><code>When a path is updated in index, Git invalidates all nodes of the
1036 recursive cache tree corresponding to the parent directories of that
1037 path. We store these tree nodes as being "invalid" by using "-1" as the
1038 number of cache entries. Invalid nodes still store a span of index
1039 entries, allowing Git to focus its efforts when reconstructing a full
1040 cache tree.</code></pre>
1041 </div></div>
1042 <div class="literalblock">
1043 <div class="content">
1044 <pre><code>The signature for this extension is { 'T', 'R', 'E', 'E' }.</code></pre>
1045 </div></div>
1046 <div class="literalblock">
1047 <div class="content">
1048 <pre><code>A series of entries fill the entire extension; each of which
1049 consists of:</code></pre>
1050 </div></div>
1051 <div class="ulist"><ul>
1052 <li>
1054 NUL-terminated path component (relative to its parent directory);
1055 </p>
1056 </li>
1057 <li>
1059 ASCII decimal number of entries in the index that is covered by the
1060 tree this entry represents (entry_count);
1061 </p>
1062 </li>
1063 <li>
1065 A space (ASCII 32);
1066 </p>
1067 </li>
1068 <li>
1070 ASCII decimal number that represents the number of subtrees this
1071 tree has;
1072 </p>
1073 </li>
1074 <li>
1076 A newline (ASCII 10); and
1077 </p>
1078 </li>
1079 <li>
1081 Object name for the object that would result from writing this span
1082 of index as a tree.
1083 </p>
1084 <div class="literalblock">
1085 <div class="content">
1086 <pre><code>An entry can be in an invalidated state and is represented by having
1087 a negative number in the entry_count field. In this case, there is no
1088 object name and the next entry starts immediately after the newline.
1089 When writing an invalid entry, -1 should always be used as entry_count.</code></pre>
1090 </div></div>
1091 <div class="literalblock">
1092 <div class="content">
1093 <pre><code>The entries are written out in the top-down, depth-first order. The
1094 first entry represents the root level of the repository, followed by the
1095 first subtree--let's call this A--of the root level (with its name
1096 relative to the root level), followed by the first subtree of A (with
1097 its name relative to A), and so on. The specified number of subtrees
1098 indicates when the current level of the recursive stack is complete.</code></pre>
1099 </div></div>
1100 </li>
1101 </ul></div>
1102 </div>
1103 <div class="sect2">
1104 <h3 id="_resolve_undo">Resolve undo</h3>
1105 <div class="literalblock">
1106 <div class="content">
1107 <pre><code>A conflict is represented in the index as a set of higher stage entries.
1108 When a conflict is resolved (e.g. with "git add path"), these higher
1109 stage entries will be removed and a stage-0 entry with proper resolution
1110 is added.</code></pre>
1111 </div></div>
1112 <div class="literalblock">
1113 <div class="content">
1114 <pre><code>When these higher stage entries are removed, they are saved in the
1115 resolve undo extension, so that conflicts can be recreated (e.g. with
1116 "git checkout -m"), in case users want to redo a conflict resolution
1117 from scratch.</code></pre>
1118 </div></div>
1119 <div class="literalblock">
1120 <div class="content">
1121 <pre><code>The signature for this extension is { 'R', 'E', 'U', 'C' }.</code></pre>
1122 </div></div>
1123 <div class="literalblock">
1124 <div class="content">
1125 <pre><code>A series of entries fill the entire extension; each of which
1126 consists of:</code></pre>
1127 </div></div>
1128 <div class="ulist"><ul>
1129 <li>
1131 NUL-terminated pathname the entry describes (relative to the root of
1132 the repository, i.e. full pathname);
1133 </p>
1134 </li>
1135 <li>
1137 Three NUL-terminated ASCII octal numbers, entry mode of entries in
1138 stage 1 to 3 (a missing stage is represented by "0" in this field);
1140 </p>
1141 </li>
1142 <li>
1144 At most three object names of the entry in stages from 1 to 3
1145 (nothing is written for a missing stage).
1146 </p>
1147 </li>
1148 </ul></div>
1149 </div>
1150 <div class="sect2">
1151 <h3 id="_split_index">Split index</h3>
1152 <div class="literalblock">
1153 <div class="content">
1154 <pre><code>In split index mode, the majority of index entries could be stored
1155 in a separate file. This extension records the changes to be made on
1156 top of that to produce the final index.</code></pre>
1157 </div></div>
1158 <div class="literalblock">
1159 <div class="content">
1160 <pre><code>The signature for this extension is { 'l', 'i', 'n', 'k' }.</code></pre>
1161 </div></div>
1162 <div class="literalblock">
1163 <div class="content">
1164 <pre><code>The extension consists of:</code></pre>
1165 </div></div>
1166 <div class="ulist"><ul>
1167 <li>
1169 Hash of the shared index file. The shared index file path
1170 is $GIT_DIR/sharedindex.&lt;hash&gt;. If all bits are zero, the
1171 index does not require a shared index file.
1172 </p>
1173 </li>
1174 <li>
1176 An ewah-encoded delete bitmap, each bit represents an entry in the
1177 shared index. If a bit is set, its corresponding entry in the
1178 shared index will be removed from the final index. Note, because
1179 a delete operation changes index entry positions, but we do need
1180 original positions in replace phase, it&#8217;s best to just mark
1181 entries for removal, then do a mass deletion after replacement.
1182 </p>
1183 </li>
1184 <li>
1186 An ewah-encoded replace bitmap, each bit represents an entry in
1187 the shared index. If a bit is set, its corresponding entry in the
1188 shared index will be replaced with an entry in this index
1189 file. All replaced entries are stored in sorted order in this
1190 index. The first "1" bit in the replace bitmap corresponds to the
1191 first index entry, the second "1" bit to the second entry and so
1192 on. Replaced entries may have empty path names to save space.
1193 </p>
1194 <div class="literalblock">
1195 <div class="content">
1196 <pre><code>The remaining index entries after replaced ones will be added to the
1197 final index. These added entries are also sorted by entry name then
1198 stage.</code></pre>
1199 </div></div>
1200 </li>
1201 </ul></div>
1202 </div>
1203 </div>
1204 </div>
1205 <div class="sect1">
1206 <h2 id="_untracked_cache">Untracked cache</h2>
1207 <div class="sectionbody">
1208 <div class="literalblock">
1209 <div class="content">
1210 <pre><code>Untracked cache saves the untracked file list and necessary data to
1211 verify the cache. The signature for this extension is { 'U', 'N',
1212 'T', 'R' }.</code></pre>
1213 </div></div>
1214 <div class="literalblock">
1215 <div class="content">
1216 <pre><code>The extension starts with</code></pre>
1217 </div></div>
1218 <div class="ulist"><ul>
1219 <li>
1221 A sequence of NUL-terminated strings, preceded by the size of the
1222 sequence in variable width encoding. Each string describes the
1223 environment where the cache can be used.
1224 </p>
1225 </li>
1226 <li>
1228 Stat data of $GIT_DIR/info/exclude. See "Index entry" section from
1229 ctime field until "file size".
1230 </p>
1231 </li>
1232 <li>
1234 Stat data of core.excludesFile
1235 </p>
1236 </li>
1237 <li>
1239 32-bit dir_flags (see struct dir_struct)
1240 </p>
1241 </li>
1242 <li>
1244 Hash of $GIT_DIR/info/exclude. A null hash means the file
1245 does not exist.
1246 </p>
1247 </li>
1248 <li>
1250 Hash of core.excludesFile. A null hash means the file does
1251 not exist.
1252 </p>
1253 </li>
1254 <li>
1256 NUL-terminated string of per-dir exclude file name. This usually
1257 is ".gitignore".
1258 </p>
1259 </li>
1260 <li>
1262 The number of following directory blocks, variable width
1263 encoding. If this number is zero, the extension ends here with a
1264 following NUL.
1265 </p>
1266 </li>
1267 <li>
1269 A number of directory blocks in depth-first-search order, each
1270 consists of
1271 </p>
1272 </li>
1273 <li>
1275 The number of untracked entries, variable width encoding.
1276 </p>
1277 </li>
1278 <li>
1280 The number of sub-directory blocks, variable width encoding.
1281 </p>
1282 </li>
1283 <li>
1285 The directory name terminated by NUL.
1286 </p>
1287 </li>
1288 <li>
1290 A number of untracked file/dir names terminated by NUL.
1291 </p>
1292 </li>
1293 </ul></div>
1294 <div class="paragraph"><p>The remaining data of each directory block is grouped by type:</p></div>
1295 <div class="ulist"><ul>
1296 <li>
1298 An ewah bitmap, the n-th bit marks whether the n-th directory has
1299 valid untracked cache entries.
1300 </p>
1301 </li>
1302 <li>
1304 An ewah bitmap, the n-th bit records "check-only" bit of
1305 read_directory_recursive() for the n-th directory.
1306 </p>
1307 </li>
1308 <li>
1310 An ewah bitmap, the n-th bit indicates whether hash and stat data
1311 is valid for the n-th directory and exists in the next data.
1312 </p>
1313 </li>
1314 <li>
1316 An array of stat data. The n-th data corresponds with the n-th
1317 "one" bit in the previous ewah bitmap.
1318 </p>
1319 </li>
1320 <li>
1322 An array of hashes. The n-th hash corresponds with the n-th "one" bit
1323 in the previous ewah bitmap.
1324 </p>
1325 </li>
1326 <li>
1328 One NUL.
1329 </p>
1330 </li>
1331 </ul></div>
1332 </div>
1333 </div>
1334 <div class="sect1">
1335 <h2 id="_file_system_monitor_cache">File System Monitor cache</h2>
1336 <div class="sectionbody">
1337 <div class="literalblock">
1338 <div class="content">
1339 <pre><code>The file system monitor cache tracks files for which the core.fsmonitor
1340 hook has told us about changes. The signature for this extension is
1341 { 'F', 'S', 'M', 'N' }.</code></pre>
1342 </div></div>
1343 <div class="literalblock">
1344 <div class="content">
1345 <pre><code>The extension starts with</code></pre>
1346 </div></div>
1347 <div class="ulist"><ul>
1348 <li>
1350 32-bit version number: the current supported versions are 1 and 2.
1351 </p>
1352 </li>
1353 <li>
1355 (Version 1)
1356 64-bit time: the extension data reflects all changes through the given
1357 time which is stored as the nanoseconds elapsed since midnight,
1358 January 1, 1970.
1359 </p>
1360 </li>
1361 <li>
1363 (Version 2)
1364 A null terminated string: an opaque token defined by the file system
1365 monitor application. The extension data reflects all changes relative
1366 to that token.
1367 </p>
1368 </li>
1369 <li>
1371 32-bit bitmap size: the size of the CE_FSMONITOR_VALID bitmap.
1372 </p>
1373 </li>
1374 <li>
1376 An ewah bitmap, the n-th bit indicates whether the n-th index entry
1377 is not CE_FSMONITOR_VALID.
1378 </p>
1379 </li>
1380 </ul></div>
1381 </div>
1382 </div>
1383 <div class="sect1">
1384 <h2 id="_end_of_index_entry">End of Index Entry</h2>
1385 <div class="sectionbody">
1386 <div class="literalblock">
1387 <div class="content">
1388 <pre><code>The End of Index Entry (EOIE) is used to locate the end of the variable
1389 length index entries and the beginning of the extensions. Code can take
1390 advantage of this to quickly locate the index extensions without having
1391 to parse through all of the index entries.</code></pre>
1392 </div></div>
1393 <div class="literalblock">
1394 <div class="content">
1395 <pre><code>Because it must be able to be loaded before the variable length cache
1396 entries and other index extensions, this extension must be written last.
1397 The signature for this extension is { 'E', 'O', 'I', 'E' }.</code></pre>
1398 </div></div>
1399 <div class="literalblock">
1400 <div class="content">
1401 <pre><code>The extension consists of:</code></pre>
1402 </div></div>
1403 <div class="ulist"><ul>
1404 <li>
1406 32-bit offset to the end of the index entries
1407 </p>
1408 </li>
1409 <li>
1411 Hash over the extension types and their sizes (but not
1412 their contents). E.g. if we have "TREE" extension that is N-bytes
1413 long, "REUC" extension that is M-bytes long, followed by "EOIE",
1414 then the hash would be:
1415 </p>
1416 <div class="literalblock">
1417 <div class="content">
1418 <pre><code>Hash("TREE" + &lt;binary representation of N&gt; +
1419 "REUC" + &lt;binary representation of M&gt;)</code></pre>
1420 </div></div>
1421 </li>
1422 </ul></div>
1423 </div>
1424 </div>
1425 <div class="sect1">
1426 <h2 id="_index_entry_offset_table">Index Entry Offset Table</h2>
1427 <div class="sectionbody">
1428 <div class="literalblock">
1429 <div class="content">
1430 <pre><code>The Index Entry Offset Table (IEOT) is used to help address the CPU
1431 cost of loading the index by enabling multi-threading the process of
1432 converting cache entries from the on-disk format to the in-memory format.
1433 The signature for this extension is { 'I', 'E', 'O', 'T' }.</code></pre>
1434 </div></div>
1435 <div class="literalblock">
1436 <div class="content">
1437 <pre><code>The extension consists of:</code></pre>
1438 </div></div>
1439 <div class="ulist"><ul>
1440 <li>
1442 32-bit version (currently 1)
1443 </p>
1444 </li>
1445 <li>
1447 A number of index offset entries each consisting of:
1448 </p>
1449 </li>
1450 <li>
1452 32-bit offset from the beginning of the file to the first cache entry
1453 in this block of entries.
1454 </p>
1455 </li>
1456 <li>
1458 32-bit count of cache entries in this block
1459 </p>
1460 </li>
1461 </ul></div>
1462 </div>
1463 </div>
1464 <div class="sect1">
1465 <h2 id="_sparse_directory_entries">Sparse Directory Entries</h2>
1466 <div class="sectionbody">
1467 <div class="literalblock">
1468 <div class="content">
1469 <pre><code>When using sparse-checkout in cone mode, some entire directories within
1470 the index can be summarized by pointing to a tree object instead of the
1471 entire expanded list of paths within that tree. An index containing such
1472 entries is a "sparse index". Index format versions 4 and less were not
1473 implemented with such entries in mind. Thus, for these versions, an
1474 index containing sparse directory entries will include this extension
1475 with signature { 's', 'd', 'i', 'r' }. Like the split-index extension,
1476 tools should avoid interacting with a sparse index unless they understand
1477 this extension.</code></pre>
1478 </div></div>
1479 </div>
1480 </div>
1481 <div class="sect1">
1482 <h2 id="_git">GIT</h2>
1483 <div class="sectionbody">
1484 <div class="paragraph"><p>Part of the <a href="git.html">git(1)</a> suite</p></div>
1485 </div>
1486 </div>
1487 </div>
1488 <div id="footnotes"><hr /></div>
1489 <div id="footer">
1490 <div id="footer-text">
1491 Last updated
1492 2022-08-18 14:11:07 PDT
1493 </div>
1494 </div>
1495 </body>
1496 </html>