blob: ee6533b3c51c835c73c007bf1b2dc11d0295c3e6 [file] [log] [blame]
Junio C Hamanodf60f442007-02-07 05:52:371<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
2 "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
4<head>
Junio C Hamano9d971152012-12-19 00:43:115<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8" />
Junio C Hamanoc14e6ad2014-10-31 20:25:536<meta name="generator" content="AsciiDoc 8.6.9" />
Junio C Hamano68cf15a2010-11-06 01:01:597<title>git-fast-import(1)</title>
Junio C Hamanodf60f442007-02-07 05:52:378<style type="text/css">
Junio C Hamano9d971152012-12-19 00:43:119/* Shared CSS for AsciiDoc xhtml11 and html5 backends */
10
11/* Default font. */
12body {
13 font-family: Georgia,serif;
14}
15
16/* Title font. */
17h1, h2, h3, h4, h5, h6,
18div.title, caption.title,
19thead, p.table.header,
20#toctitle,
21#author, #revnumber, #revdate, #revremark,
22#footer {
23 font-family: Arial,Helvetica,sans-serif;
Junio C Hamanodf60f442007-02-07 05:52:3724}
25
26body {
27 margin: 1em 5% 1em 5%;
28}
29
Junio C Hamanoba4b9282008-07-06 05:20:3130a {
31 color: blue;
32 text-decoration: underline;
33}
34a:visited {
35 color: fuchsia;
36}
Junio C Hamanodf60f442007-02-07 05:52:3737
38em {
39 font-style: italic;
Junio C Hamano68cf15a2010-11-06 01:01:5940 color: navy;
Junio C Hamanodf60f442007-02-07 05:52:3741}
42
43strong {
44 font-weight: bold;
Junio C Hamano68cf15a2010-11-06 01:01:5945 color: #083194;
Junio C Hamanodf60f442007-02-07 05:52:3746}
47
Junio C Hamanodf60f442007-02-07 05:52:3748h1, h2, h3, h4, h5, h6 {
49 color: #527bbd;
Junio C Hamanodf60f442007-02-07 05:52:3750 margin-top: 1.2em;
51 margin-bottom: 0.5em;
52 line-height: 1.3;
53}
54
Junio C Hamanoba4b9282008-07-06 05:20:3155h1, h2, h3 {
Junio C Hamanodf60f442007-02-07 05:52:3756 border-bottom: 2px solid silver;
57}
58h2 {
Junio C Hamanodf60f442007-02-07 05:52:3759 padding-top: 0.5em;
60}
Junio C Hamanoba4b9282008-07-06 05:20:3161h3 {
62 float: left;
63}
64h3 + * {
65 clear: left;
66}
Junio C Hamano9d971152012-12-19 00:43:1167h5 {
68 font-size: 1.0em;
69}
Junio C Hamanodf60f442007-02-07 05:52:3770
71div.sectionbody {
Junio C Hamanodf60f442007-02-07 05:52:3772 margin-left: 0;
73}
74
75hr {
76 border: 1px solid silver;
77}
78
79p {
80 margin-top: 0.5em;
81 margin-bottom: 0.5em;
82}
83
Junio C Hamano68cf15a2010-11-06 01:01:5984ul, ol, li > p {
85 margin-top: 0;
86}
Junio C Hamano9d971152012-12-19 00:43:1187ul > li { color: #aaa; }
88ul > li > * { color: black; }
Junio C Hamano68cf15a2010-11-06 01:01:5989
Junio C Hamanoc14e6ad2014-10-31 20:25:5390.monospaced, code, pre {
91 font-family: "Courier New", Courier, monospace;
92 font-size: inherit;
93 color: navy;
Junio C Hamanodf60f442007-02-07 05:52:3794 padding: 0;
95 margin: 0;
96}
Junio C Hamanoc14e6ad2014-10-31 20:25:5397pre {
98 white-space: pre-wrap;
99}
Junio C Hamanodf60f442007-02-07 05:52:37100
Junio C Hamano9d971152012-12-19 00:43:11101#author {
Junio C Hamanodf60f442007-02-07 05:52:37102 color: #527bbd;
Junio C Hamanodf60f442007-02-07 05:52:37103 font-weight: bold;
Junio C Hamanoba4b9282008-07-06 05:20:31104 font-size: 1.1em;
Junio C Hamanodf60f442007-02-07 05:52:37105}
Junio C Hamano9d971152012-12-19 00:43:11106#email {
Junio C Hamanodf60f442007-02-07 05:52:37107}
Junio C Hamano9d971152012-12-19 00:43:11108#revnumber, #revdate, #revremark {
Junio C Hamanodf60f442007-02-07 05:52:37109}
110
Junio C Hamano9d971152012-12-19 00:43:11111#footer {
Junio C Hamanodf60f442007-02-07 05:52:37112 font-size: small;
113 border-top: 2px solid silver;
114 padding-top: 0.5em;
115 margin-top: 4.0em;
116}
Junio C Hamano9d971152012-12-19 00:43:11117#footer-text {
Junio C Hamanodf60f442007-02-07 05:52:37118 float: left;
119 padding-bottom: 0.5em;
120}
Junio C Hamano9d971152012-12-19 00:43:11121#footer-badges {
Junio C Hamanodf60f442007-02-07 05:52:37122 float: right;
123 padding-bottom: 0.5em;
124}
125
Junio C Hamano9d971152012-12-19 00:43:11126#preamble {
Junio C Hamano68cf15a2010-11-06 01:01:59127 margin-top: 1.5em;
128 margin-bottom: 1.5em;
129}
Junio C Hamano9d971152012-12-19 00:43:11130div.imageblock, div.exampleblock, div.verseblock,
Junio C Hamanodf60f442007-02-07 05:52:37131div.quoteblock, div.literalblock, div.listingblock, div.sidebarblock,
132div.admonitionblock {
Junio C Hamano7bd050f2011-09-22 06:32:22133 margin-top: 1.0em;
Junio C Hamanodf60f442007-02-07 05:52:37134 margin-bottom: 1.5em;
135}
136div.admonitionblock {
Junio C Hamano7bd050f2011-09-22 06:32:22137 margin-top: 2.0em;
138 margin-bottom: 2.0em;
139 margin-right: 10%;
140 color: #606060;
Junio C Hamanodf60f442007-02-07 05:52:37141}
142
143div.content { /* Block element content. */
144 padding: 0;
145}
146
147/* Block element titles. */
148div.title, caption.title {
Junio C Hamano68cf15a2010-11-06 01:01:59149 color: #527bbd;
Junio C Hamanodf60f442007-02-07 05:52:37150 font-weight: bold;
151 text-align: left;
152 margin-top: 1.0em;
153 margin-bottom: 0.5em;
154}
155div.title + * {
156 margin-top: 0;
157}
158
159td div.title:first-child {
160 margin-top: 0.0em;
161}
162div.content div.title:first-child {
163 margin-top: 0.0em;
164}
165div.content + div.title {
166 margin-top: 0.0em;
167}
168
169div.sidebarblock > div.content {
170 background: #ffffee;
Junio C Hamano9d971152012-12-19 00:43:11171 border: 1px solid #dddddd;
172 border-left: 4px solid #f0f0f0;
Junio C Hamanodf60f442007-02-07 05:52:37173 padding: 0.5em;
174}
175
176div.listingblock > div.content {
Junio C Hamano9d971152012-12-19 00:43:11177 border: 1px solid #dddddd;
178 border-left: 5px solid #f0f0f0;
179 background: #f8f8f8;
Junio C Hamanodf60f442007-02-07 05:52:37180 padding: 0.5em;
181}
182
Junio C Hamano7bd050f2011-09-22 06:32:22183div.quoteblock, div.verseblock {
184 padding-left: 1.0em;
185 margin-left: 1.0em;
Junio C Hamano68cf15a2010-11-06 01:01:59186 margin-right: 10%;
Junio C Hamano9d971152012-12-19 00:43:11187 border-left: 5px solid #f0f0f0;
188 color: #888;
Junio C Hamanodf60f442007-02-07 05:52:37189}
Junio C Hamano7bd050f2011-09-22 06:32:22190
Junio C Hamano68cf15a2010-11-06 01:01:59191div.quoteblock > div.attribution {
192 padding-top: 0.5em;
Junio C Hamanodf60f442007-02-07 05:52:37193 text-align: right;
194}
Junio C Hamano68cf15a2010-11-06 01:01:59195
Junio C Hamano9d971152012-12-19 00:43:11196div.verseblock > pre.content {
197 font-family: inherit;
198 font-size: inherit;
Junio C Hamano68cf15a2010-11-06 01:01:59199}
200div.verseblock > div.attribution {
201 padding-top: 0.75em;
202 text-align: left;
203}
204/* DEPRECATED: Pre version 8.2.7 verse style literal block. */
Junio C Hamanoba4b9282008-07-06 05:20:31205div.verseblock + div.attribution {
206 text-align: left;
207}
Junio C Hamanodf60f442007-02-07 05:52:37208
209div.admonitionblock .icon {
210 vertical-align: top;
211 font-size: 1.1em;
212 font-weight: bold;
213 text-decoration: underline;
214 color: #527bbd;
215 padding-right: 0.5em;
216}
217div.admonitionblock td.content {
218 padding-left: 0.5em;
Junio C Hamano7bd050f2011-09-22 06:32:22219 border-left: 3px solid #dddddd;
Junio C Hamanodf60f442007-02-07 05:52:37220}
221
222div.exampleblock > div.content {
Junio C Hamano7bd050f2011-09-22 06:32:22223 border-left: 3px solid #dddddd;
224 padding-left: 0.5em;
Junio C Hamanodf60f442007-02-07 05:52:37225}
226
Junio C Hamanodf60f442007-02-07 05:52:37227div.imageblock div.content { padding-left: 0; }
Junio C Hamanoc14e6ad2014-10-31 20:25:53228span.image img { border-style: none; vertical-align: text-bottom; }
Junio C Hamano68cf15a2010-11-06 01:01:59229a.image:visited { color: white; }
Junio C Hamanodf60f442007-02-07 05:52:37230
231dl {
232 margin-top: 0.8em;
233 margin-bottom: 0.8em;
234}
235dt {
236 margin-top: 0.5em;
237 margin-bottom: 0;
Junio C Hamano68cf15a2010-11-06 01:01:59238 font-style: normal;
239 color: navy;
Junio C Hamanodf60f442007-02-07 05:52:37240}
241dd > *:first-child {
Junio C Hamano68cf15a2010-11-06 01:01:59242 margin-top: 0.1em;
Junio C Hamanodf60f442007-02-07 05:52:37243}
244
245ul, ol {
246 list-style-position: outside;
247}
Junio C Hamano68cf15a2010-11-06 01:01:59248ol.arabic {
249 list-style-type: decimal;
250}
251ol.loweralpha {
Junio C Hamanodf60f442007-02-07 05:52:37252 list-style-type: lower-alpha;
253}
Junio C Hamano68cf15a2010-11-06 01:01:59254ol.upperalpha {
255 list-style-type: upper-alpha;
256}
257ol.lowerroman {
258 list-style-type: lower-roman;
259}
260ol.upperroman {
261 list-style-type: upper-roman;
262}
263
264div.compact ul, div.compact ol,
265div.compact p, div.compact p,
266div.compact div, div.compact div {
267 margin-top: 0.1em;
268 margin-bottom: 0.1em;
269}
Junio C Hamanodf60f442007-02-07 05:52:37270
Junio C Hamanodf60f442007-02-07 05:52:37271tfoot {
272 font-weight: bold;
273}
Junio C Hamano68cf15a2010-11-06 01:01:59274td > div.verse {
275 white-space: pre;
276}
Junio C Hamano68cf15a2010-11-06 01:01:59277
278div.hdlist {
Junio C Hamanodf60f442007-02-07 05:52:37279 margin-top: 0.8em;
280 margin-bottom: 0.8em;
281}
Junio C Hamano68cf15a2010-11-06 01:01:59282div.hdlist tr {
283 padding-bottom: 15px;
Junio C Hamanoba4b9282008-07-06 05:20:31284}
Junio C Hamano68cf15a2010-11-06 01:01:59285dt.hdlist1.strong, td.hdlist1.strong {
286 font-weight: bold;
287}
288td.hdlist1 {
Junio C Hamanodf60f442007-02-07 05:52:37289 vertical-align: top;
Junio C Hamano68cf15a2010-11-06 01:01:59290 font-style: normal;
Junio C Hamanodf60f442007-02-07 05:52:37291 padding-right: 0.8em;
Junio C Hamano68cf15a2010-11-06 01:01:59292 color: navy;
Junio C Hamanodf60f442007-02-07 05:52:37293}
Junio C Hamano68cf15a2010-11-06 01:01:59294td.hdlist2 {
Junio C Hamanodf60f442007-02-07 05:52:37295 vertical-align: top;
296}
Junio C Hamano68cf15a2010-11-06 01:01:59297div.hdlist.compact tr {
298 margin: 0;
299 padding-bottom: 0;
300}
301
302.comment {
303 background: yellow;
304}
Junio C Hamanodf60f442007-02-07 05:52:37305
Junio C Hamano7bd050f2011-09-22 06:32:22306.footnote, .footnoteref {
307 font-size: 0.8em;
308}
309
310span.footnote, span.footnoteref {
311 vertical-align: super;
312}
313
314#footnotes {
315 margin: 20px 0 20px 0;
316 padding: 7px 0 0 0;
317}
318
319#footnotes div.footnote {
320 margin: 0 0 5px 0;
321}
322
323#footnotes hr {
324 border: none;
325 border-top: 1px solid silver;
326 height: 1px;
327 text-align: left;
328 margin-left: 0;
329 width: 20%;
330 min-width: 100px;
331}
332
Junio C Hamano9d971152012-12-19 00:43:11333div.colist td {
334 padding-right: 0.5em;
335 padding-bottom: 0.3em;
336 vertical-align: top;
337}
338div.colist td img {
339 margin-top: 0.3em;
Junio C Hamanodf60f442007-02-07 05:52:37340}
Junio C Hamanoba4b9282008-07-06 05:20:31341
Junio C Hamano9d971152012-12-19 00:43:11342@media print {
343 #footer-badges { display: none; }
344}
345
346#toc {
Junio C Hamano7bd050f2011-09-22 06:32:22347 margin-bottom: 2.5em;
348}
349
Junio C Hamano9d971152012-12-19 00:43:11350#toctitle {
Junio C Hamanoba4b9282008-07-06 05:20:31351 color: #527bbd;
Junio C Hamanoba4b9282008-07-06 05:20:31352 font-size: 1.1em;
353 font-weight: bold;
354 margin-top: 1.0em;
355 margin-bottom: 0.1em;
356}
357
Junio C Hamanoc14e6ad2014-10-31 20:25:53358div.toclevel0, div.toclevel1, div.toclevel2, div.toclevel3, div.toclevel4 {
Junio C Hamanoba4b9282008-07-06 05:20:31359 margin-top: 0;
360 margin-bottom: 0;
361}
362div.toclevel2 {
363 margin-left: 2em;
364 font-size: 0.9em;
365}
366div.toclevel3 {
367 margin-left: 4em;
368 font-size: 0.9em;
369}
370div.toclevel4 {
371 margin-left: 6em;
372 font-size: 0.9em;
373}
Junio C Hamano9d971152012-12-19 00:43:11374
375span.aqua { color: aqua; }
376span.black { color: black; }
377span.blue { color: blue; }
378span.fuchsia { color: fuchsia; }
379span.gray { color: gray; }
380span.green { color: green; }
381span.lime { color: lime; }
382span.maroon { color: maroon; }
383span.navy { color: navy; }
384span.olive { color: olive; }
385span.purple { color: purple; }
386span.red { color: red; }
387span.silver { color: silver; }
388span.teal { color: teal; }
389span.white { color: white; }
390span.yellow { color: yellow; }
391
392span.aqua-background { background: aqua; }
393span.black-background { background: black; }
394span.blue-background { background: blue; }
395span.fuchsia-background { background: fuchsia; }
396span.gray-background { background: gray; }
397span.green-background { background: green; }
398span.lime-background { background: lime; }
399span.maroon-background { background: maroon; }
400span.navy-background { background: navy; }
401span.olive-background { background: olive; }
402span.purple-background { background: purple; }
403span.red-background { background: red; }
404span.silver-background { background: silver; }
405span.teal-background { background: teal; }
406span.white-background { background: white; }
407span.yellow-background { background: yellow; }
408
409span.big { font-size: 2em; }
410span.small { font-size: 0.6em; }
411
412span.underline { text-decoration: underline; }
413span.overline { text-decoration: overline; }
414span.line-through { text-decoration: line-through; }
415
Junio C Hamanoc14e6ad2014-10-31 20:25:53416div.unbreakable { page-break-inside: avoid; }
417
Junio C Hamano9d971152012-12-19 00:43:11418
419/*
420 * xhtml11 specific
421 *
422 * */
423
424div.tableblock {
425 margin-top: 1.0em;
426 margin-bottom: 1.5em;
427}
428div.tableblock > table {
429 border: 3px solid #527bbd;
430}
431thead, p.table.header {
432 font-weight: bold;
433 color: #527bbd;
434}
435p.table {
436 margin-top: 0;
437}
438/* Because the table frame attribute is overriden by CSS in most browsers. */
439div.tableblock > table[frame="void"] {
440 border-style: none;
441}
442div.tableblock > table[frame="hsides"] {
443 border-left-style: none;
444 border-right-style: none;
445}
446div.tableblock > table[frame="vsides"] {
447 border-top-style: none;
448 border-bottom-style: none;
449}
450
451
452/*
453 * html5 specific
454 *
455 * */
456
457table.tableblock {
458 margin-top: 1.0em;
459 margin-bottom: 1.5em;
460}
461thead, p.tableblock.header {
462 font-weight: bold;
463 color: #527bbd;
464}
465p.tableblock {
466 margin-top: 0;
467}
468table.tableblock {
469 border-width: 3px;
470 border-spacing: 0px;
471 border-style: solid;
472 border-color: #527bbd;
473 border-collapse: collapse;
474}
475th.tableblock, td.tableblock {
476 border-width: 1px;
477 padding: 4px;
478 border-style: solid;
479 border-color: #527bbd;
480}
481
482table.tableblock.frame-topbot {
483 border-left-style: hidden;
484 border-right-style: hidden;
485}
486table.tableblock.frame-sides {
487 border-top-style: hidden;
488 border-bottom-style: hidden;
489}
490table.tableblock.frame-none {
491 border-style: hidden;
492}
493
494th.tableblock.halign-left, td.tableblock.halign-left {
495 text-align: left;
496}
497th.tableblock.halign-center, td.tableblock.halign-center {
498 text-align: center;
499}
500th.tableblock.halign-right, td.tableblock.halign-right {
501 text-align: right;
502}
503
504th.tableblock.valign-top, td.tableblock.valign-top {
505 vertical-align: top;
506}
507th.tableblock.valign-middle, td.tableblock.valign-middle {
508 vertical-align: middle;
509}
510th.tableblock.valign-bottom, td.tableblock.valign-bottom {
511 vertical-align: bottom;
512}
513
514
515/*
516 * manpage specific
517 *
518 * */
519
520body.manpage h1 {
Junio C Hamano68cf15a2010-11-06 01:01:59521 padding-top: 0.5em;
522 padding-bottom: 0.5em;
523 border-top: 2px solid silver;
524 border-bottom: 2px solid silver;
525}
Junio C Hamano9d971152012-12-19 00:43:11526body.manpage h2 {
Junio C Hamano68cf15a2010-11-06 01:01:59527 border-style: none;
528}
Junio C Hamano9d971152012-12-19 00:43:11529body.manpage div.sectionbody {
530 margin-left: 3em;
Junio C Hamano68cf15a2010-11-06 01:01:59531}
532
533@media print {
Junio C Hamano9d971152012-12-19 00:43:11534 body.manpage div#toc { display: none; }
Junio C Hamano68cf15a2010-11-06 01:01:59535}
Junio C Hamanoc14e6ad2014-10-31 20:25:53536
537
Junio C Hamanodf60f442007-02-07 05:52:37538</style>
Junio C Hamano7bd050f2011-09-22 06:32:22539<script type="text/javascript">
540/*<![CDATA[*/
Junio C Hamano7bd050f2011-09-22 06:32:22541var asciidoc = { // Namespace.
542
543/////////////////////////////////////////////////////////////////////
544// Table Of Contents generator
545/////////////////////////////////////////////////////////////////////
546
547/* Author: Mihai Bazon, September 2002
548 * http://students.infoiasi.ro/~mishoo
549 *
550 * Table Of Content generator
551 * Version: 0.4
552 *
553 * Feel free to use this script under the terms of the GNU General Public
554 * License, as long as you do not remove or alter this notice.
555 */
556
557 /* modified by Troy D. Hanson, September 2006. License: GPL */
558 /* modified by Stuart Rackham, 2006, 2009. License: GPL */
559
560// toclevels = 1..4.
561toc: function (toclevels) {
562
563 function getText(el) {
564 var text = "";
565 for (var i = el.firstChild; i != null; i = i.nextSibling) {
566 if (i.nodeType == 3 /* Node.TEXT_NODE */) // IE doesn't speak constants.
567 text += i.data;
568 else if (i.firstChild != null)
569 text += getText(i);
570 }
571 return text;
572 }
573
574 function TocEntry(el, text, toclevel) {
575 this.element = el;
576 this.text = text;
577 this.toclevel = toclevel;
578 }
579
580 function tocEntries(el, toclevels) {
581 var result = new Array;
Junio C Hamanoc14e6ad2014-10-31 20:25:53582 var re = new RegExp('[hH]([1-'+(toclevels+1)+'])');
Junio C Hamano7bd050f2011-09-22 06:32:22583 // Function that scans the DOM tree for header elements (the DOM2
584 // nodeIterator API would be a better technique but not supported by all
585 // browsers).
586 var iterate = function (el) {
587 for (var i = el.firstChild; i != null; i = i.nextSibling) {
588 if (i.nodeType == 1 /* Node.ELEMENT_NODE */) {
589 var mo = re.exec(i.tagName);
590 if (mo && (i.getAttribute("class") || i.getAttribute("className")) != "float") {
591 result[result.length] = new TocEntry(i, getText(i), mo[1]-1);
592 }
593 iterate(i);
594 }
595 }
596 }
597 iterate(el);
598 return result;
599 }
600
601 var toc = document.getElementById("toc");
Junio C Hamano9d971152012-12-19 00:43:11602 if (!toc) {
603 return;
604 }
605
606 // Delete existing TOC entries in case we're reloading the TOC.
607 var tocEntriesToRemove = [];
608 var i;
609 for (i = 0; i < toc.childNodes.length; i++) {
610 var entry = toc.childNodes[i];
Junio C Hamanoc14e6ad2014-10-31 20:25:53611 if (entry.nodeName.toLowerCase() == 'div'
Junio C Hamano9d971152012-12-19 00:43:11612 && entry.getAttribute("class")
613 && entry.getAttribute("class").match(/^toclevel/))
614 tocEntriesToRemove.push(entry);
615 }
616 for (i = 0; i < tocEntriesToRemove.length; i++) {
617 toc.removeChild(tocEntriesToRemove[i]);
618 }
619
620 // Rebuild TOC entries.
Junio C Hamano7bd050f2011-09-22 06:32:22621 var entries = tocEntries(document.getElementById("content"), toclevels);
622 for (var i = 0; i < entries.length; ++i) {
623 var entry = entries[i];
624 if (entry.element.id == "")
625 entry.element.id = "_toc_" + i;
626 var a = document.createElement("a");
627 a.href = "#" + entry.element.id;
628 a.appendChild(document.createTextNode(entry.text));
629 var div = document.createElement("div");
630 div.appendChild(a);
631 div.className = "toclevel" + entry.toclevel;
632 toc.appendChild(div);
633 }
634 if (entries.length == 0)
635 toc.parentNode.removeChild(toc);
636},
637
638
639/////////////////////////////////////////////////////////////////////
640// Footnotes generator
641/////////////////////////////////////////////////////////////////////
642
643/* Based on footnote generation code from:
644 * http://www.brandspankingnew.net/archive/2005/07/format_footnote.html
645 */
646
647footnotes: function () {
Junio C Hamano9d971152012-12-19 00:43:11648 // Delete existing footnote entries in case we're reloading the footnodes.
649 var i;
Junio C Hamano7bd050f2011-09-22 06:32:22650 var noteholder = document.getElementById("footnotes");
Junio C Hamano9d971152012-12-19 00:43:11651 if (!noteholder) {
652 return;
653 }
654 var entriesToRemove = [];
655 for (i = 0; i < noteholder.childNodes.length; i++) {
656 var entry = noteholder.childNodes[i];
Junio C Hamanoc14e6ad2014-10-31 20:25:53657 if (entry.nodeName.toLowerCase() == 'div' && entry.getAttribute("class") == "footnote")
Junio C Hamano9d971152012-12-19 00:43:11658 entriesToRemove.push(entry);
659 }
660 for (i = 0; i < entriesToRemove.length; i++) {
661 noteholder.removeChild(entriesToRemove[i]);
662 }
663
664 // Rebuild footnote entries.
665 var cont = document.getElementById("content");
Junio C Hamano7bd050f2011-09-22 06:32:22666 var spans = cont.getElementsByTagName("span");
667 var refs = {};
668 var n = 0;
669 for (i=0; i<spans.length; i++) {
670 if (spans[i].className == "footnote") {
671 n++;
Junio C Hamano9d971152012-12-19 00:43:11672 var note = spans[i].getAttribute("data-note");
673 if (!note) {
674 // Use [\s\S] in place of . so multi-line matches work.
675 // Because JavaScript has no s (dotall) regex flag.
676 note = spans[i].innerHTML.match(/\s*\[([\s\S]*)]\s*/)[1];
677 spans[i].innerHTML =
678 "[<a id='_footnoteref_" + n + "' href='#_footnote_" + n +
679 "' title='View footnote' class='footnote'>" + n + "</a>]";
680 spans[i].setAttribute("data-note", note);
681 }
Junio C Hamano7bd050f2011-09-22 06:32:22682 noteholder.innerHTML +=
683 "<div class='footnote' id='_footnote_" + n + "'>" +
684 "<a href='#_footnoteref_" + n + "' title='Return to text'>" +
685 n + "</a>. " + note + "</div>";
Junio C Hamano7bd050f2011-09-22 06:32:22686 var id =spans[i].getAttribute("id");
687 if (id != null) refs["#"+id] = n;
688 }
689 }
690 if (n == 0)
691 noteholder.parentNode.removeChild(noteholder);
692 else {
693 // Process footnoterefs.
694 for (i=0; i<spans.length; i++) {
695 if (spans[i].className == "footnoteref") {
696 var href = spans[i].getElementsByTagName("a")[0].getAttribute("href");
697 href = href.match(/#.*/)[0]; // Because IE return full URL.
698 n = refs[href];
699 spans[i].innerHTML =
700 "[<a href='#_footnote_" + n +
701 "' title='View footnote' class='footnote'>" + n + "</a>]";
702 }
703 }
704 }
Junio C Hamano9d971152012-12-19 00:43:11705},
706
707install: function(toclevels) {
708 var timerId;
709
710 function reinstall() {
711 asciidoc.footnotes();
712 if (toclevels) {
713 asciidoc.toc(toclevels);
714 }
715 }
716
717 function reinstallAndRemoveTimer() {
718 clearInterval(timerId);
719 reinstall();
720 }
721
722 timerId = setInterval(reinstall, 500);
723 if (document.addEventListener)
724 document.addEventListener("DOMContentLoaded", reinstallAndRemoveTimer, false);
725 else
726 window.onload = reinstallAndRemoveTimer;
Junio C Hamano7bd050f2011-09-22 06:32:22727}
728
729}
Junio C Hamano9d971152012-12-19 00:43:11730asciidoc.install();
Junio C Hamano7bd050f2011-09-22 06:32:22731/*]]>*/
732</script>
Junio C Hamanodf60f442007-02-07 05:52:37733</head>
Junio C Hamano9d971152012-12-19 00:43:11734<body class="manpage">
Junio C Hamanodf60f442007-02-07 05:52:37735<div id="header">
736<h1>
737git-fast-import(1) Manual Page
738</h1>
739<h2>NAME</h2>
740<div class="sectionbody">
741<p>git-fast-import -
Junio C Hamano053827f2007-02-14 07:23:58742 Backend for fast Git data importers
Junio C Hamanodf60f442007-02-07 05:52:37743</p>
744</div>
745</div>
Junio C Hamano7bd050f2011-09-22 06:32:22746<div id="content">
Junio C Hamano9d971152012-12-19 00:43:11747<div class="sect1">
Junio C Hamano68cf15a2010-11-06 01:01:59748<h2 id="_synopsis">SYNOPSIS</h2>
Junio C Hamanodf60f442007-02-07 05:52:37749<div class="sectionbody">
Junio C Hamano15567bc2011-07-23 00:51:59750<div class="verseblock">
Junio C Hamano9d971152012-12-19 00:43:11751<pre class="content">frontend | <em>git fast-import</em> [options]</pre>
752<div class="attribution">
Junio C Hamano15567bc2011-07-23 00:51:59753</div></div>
Junio C Hamanodf60f442007-02-07 05:52:37754</div>
Junio C Hamano9d971152012-12-19 00:43:11755</div>
756<div class="sect1">
Junio C Hamanoba4b9282008-07-06 05:20:31757<h2 id="_description">DESCRIPTION</h2>
Junio C Hamanodf60f442007-02-07 05:52:37758<div class="sectionbody">
Junio C Hamano68cf15a2010-11-06 01:01:59759<div class="paragraph"><p>This program is usually not what the end user wants to run directly.
Junio C Hamanodf60f442007-02-07 05:52:37760Most end users want to use one of the existing frontend programs,
761which parses a specific type of foreign source and feeds the contents
Junio C Hamano1aa40d22010-01-21 17:46:43762stored there to <em>git fast-import</em>.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:59763<div class="paragraph"><p>fast-import reads a mixed command/data stream from standard input and
Junio C Hamanodf60f442007-02-07 05:52:37764writes one or more packfiles directly into the current repository.
765When EOF is received on standard input, fast import writes out
766updated branch and tag refs, fully updating the current repository
Junio C Hamanoba4b9282008-07-06 05:20:31767with the newly imported data.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:59768<div class="paragraph"><p>The fast-import backend itself can import into an empty repository (one that
Junio C Hamano1aa40d22010-01-21 17:46:43769has already been initialized by <em>git init</em>) or incrementally
Junio C Hamanodf60f442007-02-07 05:52:37770update an existing populated repository. Whether or not incremental
771imports are supported from a particular foreign source depends on
Junio C Hamanoba4b9282008-07-06 05:20:31772the frontend program in use.</p></div>
Junio C Hamanodf60f442007-02-07 05:52:37773</div>
Junio C Hamano9d971152012-12-19 00:43:11774</div>
775<div class="sect1">
Junio C Hamanoba4b9282008-07-06 05:20:31776<h2 id="_options">OPTIONS</h2>
Junio C Hamanodf60f442007-02-07 05:52:37777<div class="sectionbody">
Junio C Hamano68cf15a2010-11-06 01:01:59778<div class="dlist"><dl>
779<dt class="hdlist1">
Junio C Hamano7dac6902013-01-12 08:25:31780--force
781</dt>
782<dd>
783<p>
784 Force updating modified existing branches, even if doing
785 so would cause commits to be lost (as the new commit does
786 not contain the old commit).
787</p>
788</dd>
789<dt class="hdlist1">
790--quiet
791</dt>
792<dd>
793<p>
794 Disable all non-fatal output, making fast-import silent when it
795 is successful. This option disables the output shown by
796 --stats.
797</p>
798</dd>
799<dt class="hdlist1">
800--stats
801</dt>
802<dd>
803<p>
804 Display some basic statistics about the objects fast-import has
805 created, the packfiles they were stored into, and the
806 memory used by fast-import during this run. Showing this output
807 is currently the default, but can be disabled with --quiet.
808</p>
809</dd>
810</dl></div>
811<div class="sect2">
812<h3 id="_options_for_frontends">Options for Frontends</h3>
813<div class="dlist"><dl>
814<dt class="hdlist1">
815--cat-blob-fd=&lt;fd&gt;
816</dt>
817<dd>
818<p>
Junio C Hamanoc14e6ad2014-10-31 20:25:53819 Write responses to <code>cat-blob</code> and <code>ls</code> queries to the
820 file descriptor &lt;fd&gt; instead of <code>stdout</code>. Allows <code>progress</code>
Junio C Hamano7dac6902013-01-12 08:25:31821 output intended for the end-user to be separated from other
822 output.
823</p>
824</dd>
825<dt class="hdlist1">
Junio C Hamanodf60f442007-02-07 05:52:37826--date-format=&lt;fmt&gt;
827</dt>
828<dd>
829<p>
830 Specify the type of dates the frontend will supply to
Junio C Hamanoc14e6ad2014-10-31 20:25:53831 fast-import within <code>author</code>, <code>committer</code> and <code>tagger</code> commands.
Junio C Hamanodf60f442007-02-07 05:52:37832 See &#8220;Date Formats&#8221; below for details about which formats
833 are supported, and their syntax.
834</p>
835</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59836<dt class="hdlist1">
Junio C Hamano7dac6902013-01-12 08:25:31837--done
Junio C Hamanodf60f442007-02-07 05:52:37838</dt>
839<dd>
840<p>
Junio C Hamanoc14e6ad2014-10-31 20:25:53841 Terminate with error if there is no <code>done</code> command at the end of
Junio C Hamano7dac6902013-01-12 08:25:31842 the stream. This option might be useful for detecting errors
843 that cause the frontend to terminate before it has started to
844 write a stream.
Junio C Hamanodf60f442007-02-07 05:52:37845</p>
846</dd>
Junio C Hamano7dac6902013-01-12 08:25:31847</dl></div>
848</div>
849<div class="sect2">
850<h3 id="_locations_of_marks_files">Locations of Marks Files</h3>
851<div class="dlist"><dl>
Junio C Hamano68cf15a2010-11-06 01:01:59852<dt class="hdlist1">
Junio C Hamanodf60f442007-02-07 05:52:37853--export-marks=&lt;file&gt;
854</dt>
855<dd>
856<p>
857 Dumps the internal marks table to &lt;file&gt; when complete.
Junio C Hamanoc14e6ad2014-10-31 20:25:53858 Marks are written one per line as <code>:markid SHA-1</code>.
Junio C Hamanodf60f442007-02-07 05:52:37859 Frontends can use this file to validate imports after they
Junio C Hamanod15328a2007-03-09 09:06:40860 have been completed, or to save the marks table across
861 incremental runs. As &lt;file&gt; is only opened and truncated
862 at checkpoint (or completion) the same path can also be
863 safely given to --import-marks.
864</p>
865</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59866<dt class="hdlist1">
Junio C Hamanod15328a2007-03-09 09:06:40867--import-marks=&lt;file&gt;
868</dt>
869<dd>
870<p>
871 Before processing any input, load the marks specified in
872 &lt;file&gt;. The input file must exist, must be readable, and
873 must use the same format as produced by --export-marks.
874 Multiple options may be supplied to import more than one
875 set of marks. If a mark is defined to different values,
876 the last file wins.
Junio C Hamanodf60f442007-02-07 05:52:37877</p>
878</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59879<dt class="hdlist1">
Junio C Hamano23e3f532011-02-10 02:05:29880--import-marks-if-exists=&lt;file&gt;
881</dt>
882<dd>
883<p>
884 Like --import-marks but instead of erroring out, silently
885 skips the file if it does not exist.
886</p>
887</dd>
888<dt class="hdlist1">
Junio C Hamano7dac6902013-01-12 08:25:31889--[no-]relative-marks
Junio C Hamano6ce6b6c2010-01-18 01:25:50890</dt>
891<dd>
892<p>
Junio C Hamanoa0dac242011-05-06 05:10:29893 After specifying --relative-marks the paths specified
Junio C Hamano6ce6b6c2010-01-18 01:25:50894 with --import-marks= and --export-marks= are relative
895 to an internal directory in the current repository.
896 In git-fast-import this means that the paths are relative
897 to the .git/info/fast-import directory. However, other
898 importers may use a different location.
899</p>
Junio C Hamano7dac6902013-01-12 08:25:31900<div class="paragraph"><p>Relative and non-relative marks may be combined by interweaving
901--(no-)-relative-marks with the --(import|export)-marks= options.</p></div>
Junio C Hamano6ce6b6c2010-01-18 01:25:50902</dd>
Junio C Hamano7dac6902013-01-12 08:25:31903</dl></div>
904</div>
905<div class="sect2">
906<h3 id="_performance_and_compression_tuning">Performance and Compression Tuning</h3>
907<div class="dlist"><dl>
Junio C Hamano68cf15a2010-11-06 01:01:59908<dt class="hdlist1">
Junio C Hamano7dac6902013-01-12 08:25:31909--active-branches=&lt;n&gt;
Junio C Hamano6ce6b6c2010-01-18 01:25:50910</dt>
911<dd>
912<p>
Junio C Hamano7dac6902013-01-12 08:25:31913 Maximum number of branches to maintain active at once.
914 See &#8220;Memory Utilization&#8221; below for details. Default is 5.
Junio C Hamano6ce6b6c2010-01-18 01:25:50915</p>
916</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59917<dt class="hdlist1">
Junio C Hamano7dac6902013-01-12 08:25:31918--big-file-threshold=&lt;n&gt;
Junio C Hamano0d75e872010-12-17 06:57:26919</dt>
920<dd>
921<p>
Junio C Hamano7dac6902013-01-12 08:25:31922 Maximum size of a blob that fast-import will attempt to
923 create a delta for, expressed in bytes. The default is 512m
924 (512 MiB). Some importers may wish to lower this on systems
925 with constrained memory.
Junio C Hamano0d75e872010-12-17 06:57:26926</p>
927</dd>
928<dt class="hdlist1">
Junio C Hamano7dac6902013-01-12 08:25:31929--depth=&lt;n&gt;
Junio C Hamanofbc773c2011-08-02 00:09:12930</dt>
931<dd>
932<p>
Junio C Hamano7dac6902013-01-12 08:25:31933 Maximum delta depth, for blob and tree deltification.
934 Default is 10.
Junio C Hamanofbc773c2011-08-02 00:09:12935</p>
936</dd>
937<dt class="hdlist1">
Junio C Hamano9dd8bb02007-02-12 07:15:35938--export-pack-edges=&lt;file&gt;
939</dt>
940<dd>
941<p>
942 After creating a packfile, print a line of data to
943 &lt;file&gt; listing the filename of the packfile and the last
944 commit on each branch that was written to that packfile.
945 This information may be useful after importing projects
946 whose total object set exceeds the 4 GiB packfile limit,
947 as these commits can be used as edge points during calls
Junio C Hamano1aa40d22010-01-21 17:46:43948 to <em>git pack-objects</em>.
Junio C Hamano9dd8bb02007-02-12 07:15:35949</p>
950</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59951<dt class="hdlist1">
Junio C Hamano7dac6902013-01-12 08:25:31952--max-pack-size=&lt;n&gt;
Junio C Hamanodfc4ce72007-02-07 23:17:29953</dt>
954<dd>
955<p>
Junio C Hamano7dac6902013-01-12 08:25:31956 Maximum size of each output packfile.
957 The default is unlimited.
Junio C Hamanodfc4ce72007-02-07 23:17:29958</p>
959</dd>
Junio C Hamanoba4b9282008-07-06 05:20:31960</dl></div>
Junio C Hamanodf60f442007-02-07 05:52:37961</div>
Junio C Hamano9d971152012-12-19 00:43:11962</div>
Junio C Hamano7dac6902013-01-12 08:25:31963</div>
Junio C Hamano9d971152012-12-19 00:43:11964<div class="sect1">
Junio C Hamanoba4b9282008-07-06 05:20:31965<h2 id="_performance">Performance</h2>
Junio C Hamanodf60f442007-02-07 05:52:37966<div class="sectionbody">
Junio C Hamano68cf15a2010-11-06 01:01:59967<div class="paragraph"><p>The design of fast-import allows it to import large projects in a minimum
Junio C Hamanodf60f442007-02-07 05:52:37968amount of memory usage and processing time. Assuming the frontend
Junio C Hamanod3339982007-02-09 08:38:48969is able to keep up with fast-import and feed it a constant stream of data,
Junio C Hamanodf60f442007-02-07 05:52:37970import times for projects holding 10+ years of history and containing
971100,000+ individual commits are generally completed in just 1-2
Junio C Hamanoba4b9282008-07-06 05:20:31972hours on quite modest (~$2,000 USD) hardware.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:59973<div class="paragraph"><p>Most bottlenecks appear to be in foreign source data access (the
Junio C Hamanod3339982007-02-09 08:38:48974source just cannot extract revisions fast enough) or disk IO (fast-import
Junio C Hamanodf60f442007-02-07 05:52:37975writes as fast as the disk will take the data). Imports will run
976faster if the source data is stored on a different drive than the
Junio C Hamanoba4b9282008-07-06 05:20:31977destination Git repository (due to less IO contention).</p></div>
Junio C Hamanodf60f442007-02-07 05:52:37978</div>
Junio C Hamano9d971152012-12-19 00:43:11979</div>
980<div class="sect1">
Junio C Hamanoba4b9282008-07-06 05:20:31981<h2 id="_development_cost">Development Cost</h2>
Junio C Hamanodf60f442007-02-07 05:52:37982<div class="sectionbody">
Junio C Hamano68cf15a2010-11-06 01:01:59983<div class="paragraph"><p>A typical frontend for fast-import tends to weigh in at approximately 200
Junio C Hamanodf60f442007-02-07 05:52:37984lines of Perl/Python/Ruby code. Most developers have been able to
985create working importers in just a couple of hours, even though it
Junio C Hamanod3339982007-02-09 08:38:48986is their first exposure to fast-import, and sometimes even to Git. This is
Junio C Hamanodf60f442007-02-07 05:52:37987an ideal situation, given that most conversion tools are throw-away
Junio C Hamanoba4b9282008-07-06 05:20:31988(use once, and never look back).</p></div>
Junio C Hamanodf60f442007-02-07 05:52:37989</div>
Junio C Hamano9d971152012-12-19 00:43:11990</div>
991<div class="sect1">
Junio C Hamanoba4b9282008-07-06 05:20:31992<h2 id="_parallel_operation">Parallel Operation</h2>
Junio C Hamanodf60f442007-02-07 05:52:37993<div class="sectionbody">
Junio C Hamano68cf15a2010-11-06 01:01:59994<div class="paragraph"><p>Like <em>git push</em> or <em>git fetch</em>, imports handled by fast-import are safe to
Junio C Hamanoc14e6ad2014-10-31 20:25:53995run alongside parallel <code>git repack -a -d</code> or <code>git gc</code> invocations,
Junio C Hamano1aa40d22010-01-21 17:46:43996or any other Git operation (including <em>git prune</em>, as loose objects
Junio C Hamanoba4b9282008-07-06 05:20:31997are never used by fast-import).</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:59998<div class="paragraph"><p>fast-import does not lock the branch or tag refs it is actively importing.
Junio C Hamanod3339982007-02-09 08:38:48999After the import, during its ref update phase, fast-import tests each
Junio C Hamanodf60f442007-02-07 05:52:371000existing branch ref to verify the update will be a fast-forward
1001update (the commit stored in the ref is contained in the new
1002history of the commit to be written). If the update is not a
Junio C Hamanod3339982007-02-09 08:38:481003fast-forward update, fast-import will skip updating that ref and instead
1004prints a warning message. fast-import will always attempt to update all
Junio C Hamanoba4b9282008-07-06 05:20:311005branch refs, and does not stop on the first failure.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:591006<div class="paragraph"><p>Branch updates can be forced with --force, but it&#8217;s recommended that
Junio C Hamanodfc4ce72007-02-07 23:17:291007this only be used on an otherwise quiet repository. Using --force
Junio C Hamanoba4b9282008-07-06 05:20:311008is not necessary for an initial import into an empty repository.</p></div>
Junio C Hamanodf60f442007-02-07 05:52:371009</div>
Junio C Hamano9d971152012-12-19 00:43:111010</div>
1011<div class="sect1">
Junio C Hamanoba4b9282008-07-06 05:20:311012<h2 id="_technical_discussion">Technical Discussion</h2>
Junio C Hamanodf60f442007-02-07 05:52:371013<div class="sectionbody">
Junio C Hamano68cf15a2010-11-06 01:01:591014<div class="paragraph"><p>fast-import tracks a set of branches in memory. Any branch can be created
Junio C Hamanodf60f442007-02-07 05:52:371015or modified at any point during the import process by sending a
Junio C Hamanoc14e6ad2014-10-31 20:25:531016<code>commit</code> command on the input stream. This design allows a frontend
Junio C Hamanodf60f442007-02-07 05:52:371017program to process an unlimited number of branches simultaneously,
1018generating commits in the order they are available from the source
Junio C Hamanoba4b9282008-07-06 05:20:311019data. It also simplifies the frontend programs considerably.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:591020<div class="paragraph"><p>fast-import does not use or alter the current working directory, or any
Junio C Hamanodf60f442007-02-07 05:52:371021file within it. (It does however update the current Git repository,
Junio C Hamanoc14e6ad2014-10-31 20:25:531022as referenced by <code>GIT_DIR</code>.) Therefore an import frontend may use
Junio C Hamanodf60f442007-02-07 05:52:371023the working directory for its own purposes, such as extracting file
1024revisions from the foreign source. This ignorance of the working
Junio C Hamanod3339982007-02-09 08:38:481025directory also allows fast-import to run very quickly, as it does not
Junio C Hamanodf60f442007-02-07 05:52:371026need to perform any costly file update operations when switching
Junio C Hamanoba4b9282008-07-06 05:20:311027between branches.</p></div>
Junio C Hamanodf60f442007-02-07 05:52:371028</div>
Junio C Hamano9d971152012-12-19 00:43:111029</div>
1030<div class="sect1">
Junio C Hamanoba4b9282008-07-06 05:20:311031<h2 id="_input_format">Input Format</h2>
Junio C Hamanodf60f442007-02-07 05:52:371032<div class="sectionbody">
Junio C Hamano68cf15a2010-11-06 01:01:591033<div class="paragraph"><p>With the exception of raw file data (which Git does not interpret)
Junio C Hamanod3339982007-02-09 08:38:481034the fast-import input format is text (ASCII) based. This text based
Junio C Hamanodf60f442007-02-07 05:52:371035format simplifies development and debugging of frontend programs,
1036especially when a higher level language such as Perl, Python or
Junio C Hamanoba4b9282008-07-06 05:20:311037Ruby is being used.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:591038<div class="paragraph"><p>fast-import is very strict about its input. Where we say SP below we mean
Junio C Hamano73d10512011-03-01 01:02:381039<strong>exactly</strong> one space. Likewise LF means one (and only one) linefeed
1040and HT one (and only one) horizontal tab.
Junio C Hamanodf60f442007-02-07 05:52:371041Supplying additional whitespace characters will cause unexpected
1042results, such as branch names or file names with leading or trailing
Junio C Hamanod3339982007-02-09 08:38:481043spaces in their name, or early termination of fast-import when it encounters
Junio C Hamanoba4b9282008-07-06 05:20:311044unexpected input.</p></div>
Junio C Hamano9d971152012-12-19 00:43:111045<div class="sect2">
1046<h3 id="_stream_comments">Stream Comments</h3>
Junio C Hamano68cf15a2010-11-06 01:01:591047<div class="paragraph"><p>To aid in debugging frontends fast-import ignores any line that
Junio C Hamanoc14e6ad2014-10-31 20:25:531048begins with <code>#</code> (ASCII pound/hash) up to and including the line
1049ending <code>LF</code>. A comment line may contain any sequence of bytes
Junio C Hamanoe52cf782007-08-19 19:15:521050that does not contain an LF and therefore may be used to include
1051any detailed debugging information that might be specific to the
Junio C Hamanoba4b9282008-07-06 05:20:311052frontend and useful when inspecting a fast-import data stream.</p></div>
Junio C Hamano9d971152012-12-19 00:43:111053</div>
1054<div class="sect2">
1055<h3 id="_date_formats">Date Formats</h3>
Junio C Hamano68cf15a2010-11-06 01:01:591056<div class="paragraph"><p>The following date formats are supported. A frontend should select
Junio C Hamanodf60f442007-02-07 05:52:371057the format it will use for this import by passing the format name
Junio C Hamanoe1aeb5e2014-06-06 19:16:291058in the --date-format=&lt;fmt&gt; command-line option.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:591059<div class="dlist"><dl>
1060<dt class="hdlist1">
Junio C Hamanoc14e6ad2014-10-31 20:25:531061<code>raw</code>
Junio C Hamanodf60f442007-02-07 05:52:371062</dt>
1063<dd>
1064<p>
Junio C Hamanoc14e6ad2014-10-31 20:25:531065 This is the Git native format and is <code>&lt;time&gt; SP &lt;offutc&gt;</code>.
Junio C Hamano68cf15a2010-11-06 01:01:591066 It is also fast-import&#8217;s default format, if --date-format was
Junio C Hamanodf60f442007-02-07 05:52:371067 not specified.
1068</p>
Junio C Hamanoc14e6ad2014-10-31 20:25:531069<div class="paragraph"><p>The time of the event is specified by <code>&lt;time&gt;</code> as the number of
Junio C Hamanodf60f442007-02-07 05:52:371070seconds since the UNIX epoch (midnight, Jan 1, 1970, UTC) and is
Junio C Hamanoba4b9282008-07-06 05:20:311071written as an ASCII decimal integer.</p></div>
Junio C Hamanoc14e6ad2014-10-31 20:25:531072<div class="paragraph"><p>The local offset is specified by <code>&lt;offutc&gt;</code> as a positive or negative
Junio C Hamanodfc4ce72007-02-07 23:17:291073offset from UTC. For example EST (which is 5 hours behind UTC)
Junio C Hamanoc14e6ad2014-10-31 20:25:531074would be expressed in <code>&lt;tz&gt;</code> by &#8220;-0500&#8221; while UTC is &#8220;+0000&#8221;.
1075The local offset does not affect <code>&lt;time&gt;</code>; it is used only as an
Junio C Hamanoba4b9282008-07-06 05:20:311076advisement to help formatting routines display the timestamp.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:591077<div class="paragraph"><p>If the local offset is not available in the source material, use
Junio C Hamanodfc4ce72007-02-07 23:17:291078&#8220;+0000&#8221;, or the most common local offset. For example many
Junio C Hamanodf60f442007-02-07 05:52:371079organizations have a CVS repository which has only ever been accessed
Junio C Hamanoe3acfb82013-11-12 23:22:571080by users who are located in the same location and time zone. In this
Junio C Hamanoba4b9282008-07-06 05:20:311081case a reasonable offset from UTC could be assumed.</p></div>
Junio C Hamanoc14e6ad2014-10-31 20:25:531082<div class="paragraph"><p>Unlike the <code>rfc2822</code> format, this format is very strict. Any
Junio C Hamanoba4b9282008-07-06 05:20:311083variation in formatting will cause fast-import to reject the value.</p></div>
Junio C Hamanodf60f442007-02-07 05:52:371084</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591085<dt class="hdlist1">
Junio C Hamanoc14e6ad2014-10-31 20:25:531086<code>rfc2822</code>
Junio C Hamanodf60f442007-02-07 05:52:371087</dt>
1088<dd>
1089<p>
1090 This is the standard email format as described by RFC 2822.
1091</p>
Junio C Hamano68cf15a2010-11-06 01:01:591092<div class="paragraph"><p>An example value is &#8220;Tue Feb 6 11:22:18 2007 -0500&#8221;. The Git
Junio C Hamanod3339982007-02-09 08:38:481093parser is accurate, but a little on the lenient side. It is the
Junio C Hamano1aa40d22010-01-21 17:46:431094same parser used by <em>git am</em> when applying patches
Junio C Hamanoba4b9282008-07-06 05:20:311095received from email.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:591096<div class="paragraph"><p>Some malformed strings may be accepted as valid dates. In some of
Junio C Hamanodf60f442007-02-07 05:52:371097these cases Git will still be able to obtain the correct date from
1098the malformed string. There are also some types of malformed
1099strings which Git will parse wrong, and yet consider valid.
Junio C Hamanoba4b9282008-07-06 05:20:311100Seriously malformed strings will be rejected.</p></div>
Junio C Hamanoc14e6ad2014-10-31 20:25:531101<div class="paragraph"><p>Unlike the <code>raw</code> format above, the time zone/UTC offset information
Junio C Hamanodfc4ce72007-02-07 23:17:291102contained in an RFC 2822 date string is used to adjust the date
1103value to UTC prior to storage. Therefore it is important that
Junio C Hamanoba4b9282008-07-06 05:20:311104this information be as accurate as possible.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:591105<div class="paragraph"><p>If the source material uses RFC 2822 style dates,
Junio C Hamanod3339982007-02-09 08:38:481106the frontend should let fast-import handle the parsing and conversion
Junio C Hamanodf60f442007-02-07 05:52:371107(rather than attempting to do it itself) as the Git parser has
Junio C Hamanoba4b9282008-07-06 05:20:311108been well tested in the wild.</p></div>
Junio C Hamanoc14e6ad2014-10-31 20:25:531109<div class="paragraph"><p>Frontends should prefer the <code>raw</code> format if the source material
Junio C Hamanod3339982007-02-09 08:38:481110already uses UNIX-epoch format, can be coaxed to give dates in that
Junio C Hamanoa6387422007-08-25 03:54:271111format, or its format is easily convertible to it, as there is no
Junio C Hamanoba4b9282008-07-06 05:20:311112ambiguity in parsing.</p></div>
Junio C Hamanodf60f442007-02-07 05:52:371113</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591114<dt class="hdlist1">
Junio C Hamanoc14e6ad2014-10-31 20:25:531115<code>now</code>
Junio C Hamanodf60f442007-02-07 05:52:371116</dt>
1117<dd>
1118<p>
Junio C Hamanoe3acfb82013-11-12 23:22:571119 Always use the current time and time zone. The literal
Junio C Hamanoc14e6ad2014-10-31 20:25:531120 <code>now</code> must always be supplied for <code>&lt;when&gt;</code>.
Junio C Hamanodf60f442007-02-07 05:52:371121</p>
Junio C Hamanoe3acfb82013-11-12 23:22:571122<div class="paragraph"><p>This is a toy format. The current time and time zone of this system
Junio C Hamanodf60f442007-02-07 05:52:371123is always copied into the identity string at the time it is being
Junio C Hamanod3339982007-02-09 08:38:481124created by fast-import. There is no way to specify a different time or
Junio C Hamanoe3acfb82013-11-12 23:22:571125time zone.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:591126<div class="paragraph"><p>This particular format is supplied as it&#8217;s short to implement and
Junio C Hamanodf60f442007-02-07 05:52:371127may be useful to a process that wants to create a new commit
1128right now, without needing to use a working directory or
Junio C Hamano1aa40d22010-01-21 17:46:431129<em>git update-index</em>.</p></div>
Junio C Hamanoc14e6ad2014-10-31 20:25:531130<div class="paragraph"><p>If separate <code>author</code> and <code>committer</code> commands are used in a <code>commit</code>
Junio C Hamanodf60f442007-02-07 05:52:371131the timestamps may not match, as the system clock will be polled
1132twice (once for each command). The only way to ensure that both
1133author and committer identity information has the same timestamp
Junio C Hamanoc14e6ad2014-10-31 20:25:531134is to omit <code>author</code> (thus copying from <code>committer</code>) or to use a
1135date format other than <code>now</code>.</p></div>
Junio C Hamanodf60f442007-02-07 05:52:371136</dd>
Junio C Hamanoba4b9282008-07-06 05:20:311137</dl></div>
Junio C Hamano9d971152012-12-19 00:43:111138</div>
1139<div class="sect2">
1140<h3 id="_commands">Commands</h3>
Junio C Hamano68cf15a2010-11-06 01:01:591141<div class="paragraph"><p>fast-import accepts several commands to update the current repository
Junio C Hamanodf60f442007-02-07 05:52:371142and control the current import process. More detailed discussion
Junio C Hamanoba4b9282008-07-06 05:20:311143(with examples) of each command follows later.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:591144<div class="dlist"><dl>
1145<dt class="hdlist1">
Junio C Hamanoc14e6ad2014-10-31 20:25:531146<code>commit</code>
Junio C Hamanodf60f442007-02-07 05:52:371147</dt>
1148<dd>
1149<p>
1150 Creates a new branch or updates an existing branch by
1151 creating a new commit and updating the branch to point at
1152 the newly created commit.
1153</p>
1154</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591155<dt class="hdlist1">
Junio C Hamanoc14e6ad2014-10-31 20:25:531156<code>tag</code>
Junio C Hamanodf60f442007-02-07 05:52:371157</dt>
1158<dd>
1159<p>
1160 Creates an annotated tag object from an existing commit or
1161 branch. Lightweight tags are not supported by this command,
1162 as they are not recommended for recording meaningful points
1163 in time.
1164</p>
1165</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591166<dt class="hdlist1">
Junio C Hamanoc14e6ad2014-10-31 20:25:531167<code>reset</code>
Junio C Hamanodf60f442007-02-07 05:52:371168</dt>
1169<dd>
1170<p>
1171 Reset an existing branch (or a new branch) to a specific
1172 revision. This command must be used to change a branch to
1173 a specific revision without making a commit on it.
1174</p>
1175</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591176<dt class="hdlist1">
Junio C Hamanoc14e6ad2014-10-31 20:25:531177<code>blob</code>
Junio C Hamanodf60f442007-02-07 05:52:371178</dt>
1179<dd>
1180<p>
1181 Convert raw file data into a blob, for future use in a
Junio C Hamanoc14e6ad2014-10-31 20:25:531182 <code>commit</code> command. This command is optional and is not
Junio C Hamanodf60f442007-02-07 05:52:371183 needed to perform an import.
1184</p>
1185</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591186<dt class="hdlist1">
Junio C Hamanoc14e6ad2014-10-31 20:25:531187<code>checkpoint</code>
Junio C Hamanodf60f442007-02-07 05:52:371188</dt>
1189<dd>
1190<p>
Junio C Hamanod3339982007-02-09 08:38:481191 Forces fast-import to close the current packfile, generate its
Junio C Hamanodf60f442007-02-07 05:52:371192 unique SHA-1 checksum and index, and start a new packfile.
1193 This command is optional and is not needed to perform
1194 an import.
1195</p>
1196</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591197<dt class="hdlist1">
Junio C Hamanoc14e6ad2014-10-31 20:25:531198<code>progress</code>
Junio C Hamanoe52cf782007-08-19 19:15:521199</dt>
1200<dd>
1201<p>
1202 Causes fast-import to echo the entire line to its own
1203 standard output. This command is optional and is not needed
1204 to perform an import.
1205</p>
1206</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591207<dt class="hdlist1">
Junio C Hamanoc14e6ad2014-10-31 20:25:531208<code>done</code>
Junio C Hamanofbc773c2011-08-02 00:09:121209</dt>
1210<dd>
1211<p>
1212 Marks the end of the stream. This command is optional
Junio C Hamanoc14e6ad2014-10-31 20:25:531213 unless the <code>done</code> feature was requested using the
1214 <code>--done</code> command-line option or <code>feature done</code> command.
Junio C Hamanofbc773c2011-08-02 00:09:121215</p>
1216</dd>
1217<dt class="hdlist1">
Junio C Hamanoc14e6ad2014-10-31 20:25:531218<code>cat-blob</code>
Junio C Hamano0d75e872010-12-17 06:57:261219</dt>
1220<dd>
1221<p>
1222 Causes fast-import to print a blob in <em>cat-file --batch</em>
Junio C Hamanoc14e6ad2014-10-31 20:25:531223 format to the file descriptor set with <code>--cat-blob-fd</code> or
1224 <code>stdout</code> if unspecified.
Junio C Hamano0d75e872010-12-17 06:57:261225</p>
1226</dd>
1227<dt class="hdlist1">
Junio C Hamanoc14e6ad2014-10-31 20:25:531228<code>ls</code>
Junio C Hamano73d10512011-03-01 01:02:381229</dt>
1230<dd>
1231<p>
1232 Causes fast-import to print a line describing a directory
1233 entry in <em>ls-tree</em> format to the file descriptor set with
Junio C Hamanoc14e6ad2014-10-31 20:25:531234 <code>--cat-blob-fd</code> or <code>stdout</code> if unspecified.
Junio C Hamano73d10512011-03-01 01:02:381235</p>
1236</dd>
1237<dt class="hdlist1">
Junio C Hamanoc14e6ad2014-10-31 20:25:531238<code>feature</code>
Junio C Hamano6ce6b6c2010-01-18 01:25:501239</dt>
1240<dd>
1241<p>
Junio C Hamano0e0e0d22013-09-12 23:25:031242 Enable the specified feature. This requires that fast-import
1243 supports the specified feature, and aborts if it does not.
Junio C Hamano6ce6b6c2010-01-18 01:25:501244</p>
1245</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591246<dt class="hdlist1">
Junio C Hamanoc14e6ad2014-10-31 20:25:531247<code>option</code>
Junio C Hamano6ce6b6c2010-01-18 01:25:501248</dt>
1249<dd>
1250<p>
1251 Specify any of the options listed under OPTIONS that do not
Junio C Hamano68cf15a2010-11-06 01:01:591252 change stream semantic to suit the frontend&#8217;s needs. This
Junio C Hamano6ce6b6c2010-01-18 01:25:501253 command is optional and is not needed to perform an import.
1254</p>
1255</dd>
Junio C Hamanoba4b9282008-07-06 05:20:311256</dl></div>
Junio C Hamano9d971152012-12-19 00:43:111257</div>
1258<div class="sect2">
Junio C Hamanoc14e6ad2014-10-31 20:25:531259<h3 id="_code_commit_code"><code>commit</code></h3>
Junio C Hamano68cf15a2010-11-06 01:01:591260<div class="paragraph"><p>Create or update a branch with a new commit, recording one logical
Junio C Hamanoba4b9282008-07-06 05:20:311261change to the project.</p></div>
Junio C Hamanodf60f442007-02-07 05:52:371262<div class="literalblock">
1263<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:531264<pre><code> 'commit' SP &lt;ref&gt; LF
Junio C Hamanodf60f442007-02-07 05:52:371265 mark?
Junio C Hamano6d325df2010-01-01 00:02:471266 ('author' (SP &lt;name&gt;)? SP LT &lt;email&gt; GT SP &lt;when&gt; LF)?
1267 'committer' (SP &lt;name&gt;)? SP LT &lt;email&gt; GT SP &lt;when&gt; LF
Junio C Hamanodf60f442007-02-07 05:52:371268 data
Junio C Hamanoe6f28d02013-09-17 21:34:001269 ('from' SP &lt;commit-ish&gt; LF)?
1270 ('merge' SP &lt;commit-ish&gt; LF)?
Junio C Hamano3b70d3c2009-11-21 17:37:371271 (filemodify | filedelete | filecopy | filerename | filedeleteall | notemodify)*
Junio C Hamanoc14e6ad2014-10-31 20:25:531272 LF?</code></pre>
Junio C Hamanodf60f442007-02-07 05:52:371273</div></div>
Junio C Hamanoc14e6ad2014-10-31 20:25:531274<div class="paragraph"><p>where <code>&lt;ref&gt;</code> is the name of the branch to make the commit on.
1275Typically branch names are prefixed with <code>refs/heads/</code> in
1276Git, so importing the CVS branch symbol <code>RELENG-1_0</code> would use
1277<code>refs/heads/RELENG-1_0</code> for the value of <code>&lt;ref&gt;</code>. The value of
1278<code>&lt;ref&gt;</code> must be a valid refname in Git. As <code>LF</code> is not valid in
Junio C Hamanoba4b9282008-07-06 05:20:311279a Git refname, no quoting or escaping syntax is supported here.</p></div>
Junio C Hamanoc14e6ad2014-10-31 20:25:531280<div class="paragraph"><p>A <code>mark</code> command may optionally appear, requesting fast-import to save a
Junio C Hamanodf60f442007-02-07 05:52:371281reference to the newly created commit for future use by the frontend
1282(see below for format). It is very common for frontends to mark
1283every commit they create, thereby allowing future branch creation
Junio C Hamanoba4b9282008-07-06 05:20:311284from any imported commit.</p></div>
Junio C Hamanoc14e6ad2014-10-31 20:25:531285<div class="paragraph"><p>The <code>data</code> command following <code>committer</code> must supply the commit
1286message (see below for <code>data</code> command syntax). To import an empty
Junio C Hamanodf60f442007-02-07 05:52:371287commit message use a 0 length data. Commit messages are free-form
1288and are not interpreted by Git. Currently they must be encoded in
Junio C Hamanoba4b9282008-07-06 05:20:311289UTF-8, as fast-import does not permit other encodings to be specified.</p></div>
Junio C Hamanoc14e6ad2014-10-31 20:25:531290<div class="paragraph"><p>Zero or more <code>filemodify</code>, <code>filedelete</code>, <code>filecopy</code>, <code>filerename</code>,
1291<code>filedeleteall</code> and <code>notemodify</code> commands
Junio C Hamanodfc4ce72007-02-07 23:17:291292may be included to update the contents of the branch prior to
1293creating the commit. These commands may be supplied in any order.
Junio C Hamanoc14e6ad2014-10-31 20:25:531294However it is recommended that a <code>filedeleteall</code> command precede
1295all <code>filemodify</code>, <code>filecopy</code>, <code>filerename</code> and <code>notemodify</code> commands in
1296the same commit, as <code>filedeleteall</code> wipes the branch clean (see below).</p></div>
1297<div class="paragraph"><p>The <code>LF</code> after the command is optional (it used to be required).</p></div>
Junio C Hamano9d971152012-12-19 00:43:111298<div class="sect3">
Junio C Hamanoc14e6ad2014-10-31 20:25:531299<h4 id="_code_author_code"><code>author</code></h4>
1300<div class="paragraph"><p>An <code>author</code> command may optionally appear, if the author information
1301might differ from the committer information. If <code>author</code> is omitted
Junio C Hamano68cf15a2010-11-06 01:01:591302then fast-import will automatically use the committer&#8217;s information for
Junio C Hamanodf60f442007-02-07 05:52:371303the author portion of the commit. See below for a description of
Junio C Hamanoc14e6ad2014-10-31 20:25:531304the fields in <code>author</code>, as they are identical to <code>committer</code>.</p></div>
Junio C Hamano9d971152012-12-19 00:43:111305</div>
1306<div class="sect3">
Junio C Hamanoc14e6ad2014-10-31 20:25:531307<h4 id="_code_committer_code"><code>committer</code></h4>
1308<div class="paragraph"><p>The <code>committer</code> command indicates who made this commit, and when
Junio C Hamanoba4b9282008-07-06 05:20:311309they made it.</p></div>
Junio C Hamanoc14e6ad2014-10-31 20:25:531310<div class="paragraph"><p>Here <code>&lt;name&gt;</code> is the person&#8217;s display name (for example
1311&#8220;Com M Itter&#8221;) and <code>&lt;email&gt;</code> is the person&#8217;s email address
1312(&#8220;cm@example.com&#8221;). <code>LT</code> and <code>GT</code> are the literal less-than (\x3c)
Junio C Hamanodf60f442007-02-07 05:52:371313and greater-than (\x3e) symbols. These are required to delimit
1314the email address from the other fields in the line. Note that
Junio C Hamanoc14e6ad2014-10-31 20:25:531315<code>&lt;name&gt;</code> and <code>&lt;email&gt;</code> are free-form and may contain any sequence
1316of bytes, except <code>LT</code>, <code>GT</code> and <code>LF</code>. <code>&lt;name&gt;</code> is typically UTF-8 encoded.</p></div>
1317<div class="paragraph"><p>The time of the change is specified by <code>&lt;when&gt;</code> using the date format
Junio C Hamanoe1aeb5e2014-06-06 19:16:291318that was selected by the --date-format=&lt;fmt&gt; command-line option.
Junio C Hamanodf60f442007-02-07 05:52:371319See &#8220;Date Formats&#8221; above for the set of supported formats, and
Junio C Hamanoba4b9282008-07-06 05:20:311320their syntax.</p></div>
Junio C Hamano9d971152012-12-19 00:43:111321</div>
1322<div class="sect3">
Junio C Hamanoc14e6ad2014-10-31 20:25:531323<h4 id="_code_from_code"><code>from</code></h4>
1324<div class="paragraph"><p>The <code>from</code> command is used to specify the commit to initialize
Junio C Hamano5dad0832007-02-13 05:16:231325this branch from. This revision will be the first ancestor of the
Junio C Hamanoac28f432012-11-21 21:58:581326new commit. The state of the tree built at this commit will begin
Junio C Hamanoc14e6ad2014-10-31 20:25:531327with the state at the <code>from</code> commit, and be altered by the content
Junio C Hamanoac28f432012-11-21 21:58:581328modifications in this commit.</p></div>
Junio C Hamanoc14e6ad2014-10-31 20:25:531329<div class="paragraph"><p>Omitting the <code>from</code> command in the first commit of a new branch
Junio C Hamano5dad0832007-02-13 05:16:231330will cause fast-import to create that commit with no ancestor. This
1331tends to be desired only for the initial commit of a project.
Junio C Hamano25c0b702008-03-23 09:41:371332If the frontend creates all files from scratch when making a new
Junio C Hamanoc14e6ad2014-10-31 20:25:531333branch, a <code>merge</code> command may be used instead of <code>from</code> to start
Junio C Hamano25c0b702008-03-23 09:41:371334the commit with an empty tree.
Junio C Hamanoc14e6ad2014-10-31 20:25:531335Omitting the <code>from</code> command on existing branches is usually desired,
Junio C Hamano5dad0832007-02-13 05:16:231336as the current commit on that branch is automatically assumed to
Junio C Hamanoba4b9282008-07-06 05:20:311337be the first ancestor of the new commit.</p></div>
Junio C Hamanoc14e6ad2014-10-31 20:25:531338<div class="paragraph"><p>As <code>LF</code> is not valid in a Git refname or SHA-1 expression, no
1339quoting or escaping syntax is supported within <code>&lt;commit-ish&gt;</code>.</p></div>
1340<div class="paragraph"><p>Here <code>&lt;commit-ish&gt;</code> is any of the following:</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:591341<div class="ulist"><ul>
Junio C Hamanodf60f442007-02-07 05:52:371342<li>
1343<p>
Junio C Hamano68cf15a2010-11-06 01:01:591344The name of an existing branch already in fast-import&#8217;s internal branch
1345 table. If fast-import doesn&#8217;t know the name, it&#8217;s treated as a SHA-1
Junio C Hamanodf60f442007-02-07 05:52:371346 expression.
1347</p>
1348</li>
1349<li>
1350<p>
Junio C Hamanoc14e6ad2014-10-31 20:25:531351A mark reference, <code>:&lt;idnum&gt;</code>, where <code>&lt;idnum&gt;</code> is the mark number.
Junio C Hamanodf60f442007-02-07 05:52:371352</p>
Junio C Hamanoc14e6ad2014-10-31 20:25:531353<div class="paragraph"><p>The reason fast-import uses <code>:</code> to denote a mark reference is this character
1354is not legal in a Git branch name. The leading <code>:</code> makes it easy
1355to distinguish between the mark 42 (<code>:42</code>) and the branch 42 (<code>42</code>
1356or <code>refs/heads/42</code>), or an abbreviated SHA-1 which happened to
Junio C Hamanoba4b9282008-07-06 05:20:311357consist only of base-10 digits.</p></div>
Junio C Hamanoc14e6ad2014-10-31 20:25:531358<div class="paragraph"><p>Marks must be declared (via <code>mark</code>) before they can be used.</p></div>
Junio C Hamanodf60f442007-02-07 05:52:371359</li>
1360<li>
1361<p>
1362A complete 40 byte or abbreviated commit SHA-1 in hex.
1363</p>
1364</li>
1365<li>
1366<p>
1367Any valid Git SHA-1 expression that resolves to a commit. See
Junio C Hamanoa28a9202012-06-21 07:08:231368 &#8220;SPECIFYING REVISIONS&#8221; in <a href="gitrevisions.html">gitrevisions(7)</a> for details.
Junio C Hamanodf60f442007-02-07 05:52:371369</p>
1370</li>
Junio C Hamanoc8c398a2014-06-16 21:14:051371<li>
1372<p>
1373The special null SHA-1 (40 zeros) specifies that the branch is to be
1374 removed.
1375</p>
1376</li>
Junio C Hamanoba4b9282008-07-06 05:20:311377</ul></div>
Junio C Hamano68cf15a2010-11-06 01:01:591378<div class="paragraph"><p>The special case of restarting an incremental import from the
Junio C Hamanoba4b9282008-07-06 05:20:311379current branch value should be written as:</p></div>
Junio C Hamanodf60f442007-02-07 05:52:371380<div class="listingblock">
1381<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:531382<pre><code> from refs/heads/branch^0</code></pre>
Junio C Hamanodf60f442007-02-07 05:52:371383</div></div>
Junio C Hamanoc14e6ad2014-10-31 20:25:531384<div class="paragraph"><p>The <code>^0</code> suffix is necessary as fast-import does not permit a branch to
Junio C Hamanodf60f442007-02-07 05:52:371385start from itself, and the branch is created in memory before the
Junio C Hamanoc14e6ad2014-10-31 20:25:531386<code>from</code> command is even read from the input. Adding <code>^0</code> will force
Junio C Hamano68cf15a2010-11-06 01:01:591387fast-import to resolve the commit through Git&#8217;s revision parsing library,
Junio C Hamanodf60f442007-02-07 05:52:371388rather than its internal branch table, thereby loading in the
Junio C Hamanoba4b9282008-07-06 05:20:311389existing value of the branch.</p></div>
Junio C Hamano9d971152012-12-19 00:43:111390</div>
1391<div class="sect3">
Junio C Hamanoc14e6ad2014-10-31 20:25:531392<h4 id="_code_merge_code"><code>merge</code></h4>
Junio C Hamanoac28f432012-11-21 21:58:581393<div class="paragraph"><p>Includes one additional ancestor commit. The additional ancestry
1394link does not change the way the tree state is built at this commit.
Junio C Hamanoc14e6ad2014-10-31 20:25:531395If the <code>from</code> command is
1396omitted when creating a new branch, the first <code>merge</code> commit will be
Junio C Hamano25c0b702008-03-23 09:41:371397the first ancestor of the current commit, and the branch will start
Junio C Hamanoc14e6ad2014-10-31 20:25:531398out with no files. An unlimited number of <code>merge</code> commands per
Junio C Hamanod3339982007-02-09 08:38:481399commit are permitted by fast-import, thereby establishing an n-way merge.
Junio C Hamano68cf15a2010-11-06 01:01:591400However Git&#8217;s other tools never create commits with more than 15
Junio C Hamanodf60f442007-02-07 05:52:371401additional ancestors (forming a 16-way merge). For this reason
Junio C Hamanoc14e6ad2014-10-31 20:25:531402it is suggested that frontends do not use more than 15 <code>merge</code>
Junio C Hamanoba4b9282008-07-06 05:20:311403commands per commit; 16, if starting a new, empty branch.</p></div>
Junio C Hamanoc14e6ad2014-10-31 20:25:531404<div class="paragraph"><p>Here <code>&lt;commit-ish&gt;</code> is any of the commit specification expressions
1405also accepted by <code>from</code> (see above).</p></div>
Junio C Hamano9d971152012-12-19 00:43:111406</div>
1407<div class="sect3">
Junio C Hamanoc14e6ad2014-10-31 20:25:531408<h4 id="_code_filemodify_code"><code>filemodify</code></h4>
1409<div class="paragraph"><p>Included in a <code>commit</code> command to add a new file or change the
Junio C Hamanodf60f442007-02-07 05:52:371410content of an existing file. This command has two different means
Junio C Hamanoba4b9282008-07-06 05:20:311411of specifying the content of the file.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:591412<div class="dlist"><dl>
1413<dt class="hdlist1">
Junio C Hamanodf60f442007-02-07 05:52:371414External data format
1415</dt>
1416<dd>
1417<p>
1418 The data content for the file was already supplied by a prior
Junio C Hamanoc14e6ad2014-10-31 20:25:531419 <code>blob</code> command. The frontend just needs to connect it.
Junio C Hamanodf60f442007-02-07 05:52:371420</p>
1421<div class="literalblock">
1422<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:531423<pre><code> 'M' SP &lt;mode&gt; SP &lt;dataref&gt; SP &lt;path&gt; LF</code></pre>
Junio C Hamanodf60f442007-02-07 05:52:371424</div></div>
Junio C Hamanoc14e6ad2014-10-31 20:25:531425<div class="paragraph"><p>Here usually <code>&lt;dataref&gt;</code> must be either a mark reference (<code>:&lt;idnum&gt;</code>)
1426set by a prior <code>blob</code> command, or a full 40-byte SHA-1 of an
1427existing Git blob object. If <code>&lt;mode&gt;</code> is <code>040000`</code> then
1428<code>&lt;dataref&gt;</code> must be the full 40-byte SHA-1 of an existing
1429Git tree object or a mark reference set with <code>--import-marks</code>.</p></div>
Junio C Hamanodf60f442007-02-07 05:52:371430</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591431<dt class="hdlist1">
Junio C Hamanodf60f442007-02-07 05:52:371432Inline data format
1433</dt>
1434<dd>
1435<p>
1436 The data content for the file has not been supplied yet.
1437 The frontend wants to supply it as part of this modify
1438 command.
1439</p>
1440<div class="literalblock">
1441<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:531442<pre><code> 'M' SP &lt;mode&gt; SP 'inline' SP &lt;path&gt; LF
1443 data</code></pre>
Junio C Hamanodf60f442007-02-07 05:52:371444</div></div>
Junio C Hamanoc14e6ad2014-10-31 20:25:531445<div class="paragraph"><p>See below for a detailed description of the <code>data</code> command.</p></div>
Junio C Hamanodf60f442007-02-07 05:52:371446</dd>
Junio C Hamanoba4b9282008-07-06 05:20:311447</dl></div>
Junio C Hamanoc14e6ad2014-10-31 20:25:531448<div class="paragraph"><p>In both formats <code>&lt;mode&gt;</code> is the type of file entry, specified
Junio C Hamanoba4b9282008-07-06 05:20:311449in octal. Git only supports the following modes:</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:591450<div class="ulist"><ul>
Junio C Hamanodf60f442007-02-07 05:52:371451<li>
1452<p>
Junio C Hamanoc14e6ad2014-10-31 20:25:531453<code>100644</code> or <code>644</code>: A normal (not-executable) file. The majority
Junio C Hamanodf60f442007-02-07 05:52:371454 of files in most projects use this mode. If in doubt, this is
1455 what you want.
1456</p>
1457</li>
1458<li>
1459<p>
Junio C Hamanoc14e6ad2014-10-31 20:25:531460<code>100755</code> or <code>755</code>: A normal, but executable, file.
Junio C Hamanodf60f442007-02-07 05:52:371461</p>
1462</li>
1463<li>
1464<p>
Junio C Hamanoc14e6ad2014-10-31 20:25:531465<code>120000</code>: A symlink, the content of the file will be the link target.
Junio C Hamanodf60f442007-02-07 05:52:371466</p>
1467</li>
Junio C Hamano915cd9b2008-07-20 01:24:171468<li>
1469<p>
Junio C Hamanoc14e6ad2014-10-31 20:25:531470<code>160000</code>: A gitlink, SHA-1 of the object refers to a commit in
Junio C Hamano915cd9b2008-07-20 01:24:171471 another repository. Git links can only be specified by SHA or through
1472 a commit mark. They are used to implement submodules.
1473</p>
1474</li>
Junio C Hamano619596a2010-08-18 22:15:351475<li>
1476<p>
Junio C Hamanoc14e6ad2014-10-31 20:25:531477<code>040000</code>: A subdirectory. Subdirectories can only be specified by
1478 SHA or through a tree mark set with <code>--import-marks</code>.
Junio C Hamano619596a2010-08-18 22:15:351479</p>
1480</li>
Junio C Hamanoba4b9282008-07-06 05:20:311481</ul></div>
Junio C Hamanoc14e6ad2014-10-31 20:25:531482<div class="paragraph"><p>In both formats <code>&lt;path&gt;</code> is the complete path of the file to be added
Junio C Hamanoba4b9282008-07-06 05:20:311483(if not already existing) or modified (if already existing).</p></div>
Junio C Hamanoc14e6ad2014-10-31 20:25:531484<div class="paragraph"><p>A <code>&lt;path&gt;</code> string must use UNIX-style directory separators (forward
1485slash <code>/</code>), may contain any byte other than <code>LF</code>, and must not
1486start with double quote (<code>"</code>).</p></div>
Junio C Hamanobccb0db2012-11-29 22:51:201487<div class="paragraph"><p>A path can use C-style string quoting; this is accepted in all cases
1488and mandatory if the filename starts with double quote or contains
Junio C Hamanoc14e6ad2014-10-31 20:25:531489<code>LF</code>. In C-style quoting, the complete name should be surrounded with
1490double quotes, and any <code>LF</code>, backslash, or double quote characters
Junio C Hamanobccb0db2012-11-29 22:51:201491must be escaped by preceding them with a backslash (e.g.,
Junio C Hamanoc14e6ad2014-10-31 20:25:531492<code>"path/with\n, \\ and \" in it"</code>).</p></div>
1493<div class="paragraph"><p>The value of <code>&lt;path&gt;</code> must be in canonical form. That is it must not:</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:591494<div class="ulist"><ul>
Junio C Hamanodf60f442007-02-07 05:52:371495<li>
1496<p>
Junio C Hamanoc14e6ad2014-10-31 20:25:531497contain an empty directory component (e.g. <code>foo//bar</code> is invalid),
Junio C Hamanodf60f442007-02-07 05:52:371498</p>
1499</li>
1500<li>
1501<p>
Junio C Hamanoc14e6ad2014-10-31 20:25:531502end with a directory separator (e.g. <code>foo/</code> is invalid),
Junio C Hamanodf60f442007-02-07 05:52:371503</p>
1504</li>
1505<li>
1506<p>
Junio C Hamanoc14e6ad2014-10-31 20:25:531507start with a directory separator (e.g. <code>/foo</code> is invalid),
Junio C Hamanodf60f442007-02-07 05:52:371508</p>
1509</li>
1510<li>
1511<p>
Junio C Hamanoc14e6ad2014-10-31 20:25:531512contain the special component <code>.</code> or <code>..</code> (e.g. <code>foo/./bar</code> and
1513 <code>foo/../bar</code> are invalid).
Junio C Hamanodf60f442007-02-07 05:52:371514</p>
1515</li>
Junio C Hamanoba4b9282008-07-06 05:20:311516</ul></div>
Junio C Hamanoc14e6ad2014-10-31 20:25:531517<div class="paragraph"><p>The root of the tree can be represented by an empty string as <code>&lt;path&gt;</code>.</p></div>
1518<div class="paragraph"><p>It is recommended that <code>&lt;path&gt;</code> always be encoded using UTF-8.</p></div>
Junio C Hamano9d971152012-12-19 00:43:111519</div>
1520<div class="sect3">
Junio C Hamanoc14e6ad2014-10-31 20:25:531521<h4 id="_code_filedelete_code"><code>filedelete</code></h4>
1522<div class="paragraph"><p>Included in a <code>commit</code> command to remove a file or recursively
Junio C Hamano06216df2007-07-10 07:49:371523delete an entire directory from the branch. If the file or directory
1524removal makes its parent directory empty, the parent directory will
Junio C Hamanodf60f442007-02-07 05:52:371525be automatically removed too. This cascades up the tree until the
Junio C Hamanoba4b9282008-07-06 05:20:311526first non-empty directory or the root is reached.</p></div>
Junio C Hamanodf60f442007-02-07 05:52:371527<div class="literalblock">
1528<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:531529<pre><code> 'D' SP &lt;path&gt; LF</code></pre>
Junio C Hamanodf60f442007-02-07 05:52:371530</div></div>
Junio C Hamanoc14e6ad2014-10-31 20:25:531531<div class="paragraph"><p>here <code>&lt;path&gt;</code> is the complete path of the file or subdirectory to
Junio C Hamano06216df2007-07-10 07:49:371532be removed from the branch.
Junio C Hamanoc14e6ad2014-10-31 20:25:531533See <code>filemodify</code> above for a detailed description of <code>&lt;path&gt;</code>.</p></div>
Junio C Hamano9d971152012-12-19 00:43:111534</div>
1535<div class="sect3">
Junio C Hamanoc14e6ad2014-10-31 20:25:531536<h4 id="_code_filecopy_code"><code>filecopy</code></h4>
Junio C Hamano68cf15a2010-11-06 01:01:591537<div class="paragraph"><p>Recursively copies an existing file or subdirectory to a different
Junio C Hamanoc0ea7c62007-07-15 07:19:061538location within the branch. The existing file or directory must
1539exist. If the destination exists it will be completely replaced
Junio C Hamanoba4b9282008-07-06 05:20:311540by the content copied from the source.</p></div>
Junio C Hamanoc0ea7c62007-07-15 07:19:061541<div class="literalblock">
1542<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:531543<pre><code> 'C' SP &lt;path&gt; SP &lt;path&gt; LF</code></pre>
Junio C Hamanoc0ea7c62007-07-15 07:19:061544</div></div>
Junio C Hamanoc14e6ad2014-10-31 20:25:531545<div class="paragraph"><p>here the first <code>&lt;path&gt;</code> is the source location and the second
1546<code>&lt;path&gt;</code> is the destination. See <code>filemodify</code> above for a detailed
1547description of what <code>&lt;path&gt;</code> may look like. To use a source path
Junio C Hamanoba4b9282008-07-06 05:20:311548that contains SP the path must be quoted.</p></div>
Junio C Hamanoc14e6ad2014-10-31 20:25:531549<div class="paragraph"><p>A <code>filecopy</code> command takes effect immediately. Once the source
Junio C Hamanoc0ea7c62007-07-15 07:19:061550location has been copied to the destination any future commands
1551applied to the source location will not impact the destination of
Junio C Hamanoba4b9282008-07-06 05:20:311552the copy.</p></div>
Junio C Hamano9d971152012-12-19 00:43:111553</div>
1554<div class="sect3">
Junio C Hamanoc14e6ad2014-10-31 20:25:531555<h4 id="_code_filerename_code"><code>filerename</code></h4>
Junio C Hamano68cf15a2010-11-06 01:01:591556<div class="paragraph"><p>Renames an existing file or subdirectory to a different location
Junio C Hamano06216df2007-07-10 07:49:371557within the branch. The existing file or directory must exist. If
Junio C Hamanoba4b9282008-07-06 05:20:311558the destination exists it will be replaced by the source directory.</p></div>
Junio C Hamano06216df2007-07-10 07:49:371559<div class="literalblock">
1560<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:531561<pre><code> 'R' SP &lt;path&gt; SP &lt;path&gt; LF</code></pre>
Junio C Hamano06216df2007-07-10 07:49:371562</div></div>
Junio C Hamanoc14e6ad2014-10-31 20:25:531563<div class="paragraph"><p>here the first <code>&lt;path&gt;</code> is the source location and the second
1564<code>&lt;path&gt;</code> is the destination. See <code>filemodify</code> above for a detailed
1565description of what <code>&lt;path&gt;</code> may look like. To use a source path
Junio C Hamanoba4b9282008-07-06 05:20:311566that contains SP the path must be quoted.</p></div>
Junio C Hamanoc14e6ad2014-10-31 20:25:531567<div class="paragraph"><p>A <code>filerename</code> command takes effect immediately. Once the source
Junio C Hamano06216df2007-07-10 07:49:371568location has been renamed to the destination any future commands
1569applied to the source location will create new files there and not
Junio C Hamanoba4b9282008-07-06 05:20:311570impact the destination of the rename.</p></div>
Junio C Hamanoc14e6ad2014-10-31 20:25:531571<div class="paragraph"><p>Note that a <code>filerename</code> is the same as a <code>filecopy</code> followed by a
1572<code>filedelete</code> of the source location. There is a slight performance
1573advantage to using <code>filerename</code>, but the advantage is so small
Junio C Hamanoc0ea7c62007-07-15 07:19:061574that it is never worth trying to convert a delete/add pair in
Junio C Hamanoc14e6ad2014-10-31 20:25:531575source material into a rename for fast-import. This <code>filerename</code>
Junio C Hamanoc0ea7c62007-07-15 07:19:061576command is provided just to simplify frontends that already have
Junio C Hamano68cf15a2010-11-06 01:01:591577rename information and don&#8217;t want bother with decomposing it into a
Junio C Hamanoc14e6ad2014-10-31 20:25:531578<code>filecopy</code> followed by a <code>filedelete</code>.</p></div>
Junio C Hamano9d971152012-12-19 00:43:111579</div>
1580<div class="sect3">
Junio C Hamanoc14e6ad2014-10-31 20:25:531581<h4 id="_code_filedeleteall_code"><code>filedeleteall</code></h4>
1582<div class="paragraph"><p>Included in a <code>commit</code> command to remove all files (and also all
Junio C Hamanodfc4ce72007-02-07 23:17:291583directories) from the branch. This command resets the internal
1584branch structure to have no files in it, allowing the frontend
Junio C Hamanoba4b9282008-07-06 05:20:311585to subsequently add all interesting files from scratch.</p></div>
Junio C Hamanodfc4ce72007-02-07 23:17:291586<div class="literalblock">
1587<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:531588<pre><code> 'deleteall' LF</code></pre>
Junio C Hamanodfc4ce72007-02-07 23:17:291589</div></div>
Junio C Hamano68cf15a2010-11-06 01:01:591590<div class="paragraph"><p>This command is extremely useful if the frontend does not know
Junio C Hamanodfc4ce72007-02-07 23:17:291591(or does not care to know) what files are currently on the branch,
Junio C Hamanoc14e6ad2014-10-31 20:25:531592and therefore cannot generate the proper <code>filedelete</code> commands to
Junio C Hamanoba4b9282008-07-06 05:20:311593update the content.</p></div>
Junio C Hamanoc14e6ad2014-10-31 20:25:531594<div class="paragraph"><p>Issuing a <code>filedeleteall</code> followed by the needed <code>filemodify</code>
Junio C Hamanodfc4ce72007-02-07 23:17:291595commands to set the correct content will produce the same results
Junio C Hamanoc14e6ad2014-10-31 20:25:531596as sending only the needed <code>filemodify</code> and <code>filedelete</code> commands.
1597The <code>filedeleteall</code> approach may however require fast-import to use slightly
Junio C Hamanodfc4ce72007-02-07 23:17:291598more memory per active branch (less than 1 MiB for even most large
1599projects); so frontends that can easily obtain only the affected
Junio C Hamanoba4b9282008-07-06 05:20:311600paths for a commit are encouraged to do so.</p></div>
Junio C Hamano9d971152012-12-19 00:43:111601</div>
1602<div class="sect3">
Junio C Hamanoc14e6ad2014-10-31 20:25:531603<h4 id="_code_notemodify_code"><code>notemodify</code></h4>
1604<div class="paragraph"><p>Included in a <code>commit</code> <code>&lt;notes_ref&gt;</code> command to add a new note
1605annotating a <code>&lt;commit-ish&gt;</code> or change this annotation contents.
1606Internally it is similar to filemodify 100644 on <code>&lt;commit-ish&gt;</code>
Junio C Hamano15567bc2011-07-23 00:51:591607path (maybe split into subdirectories). It&#8217;s not advised to
Junio C Hamanoc14e6ad2014-10-31 20:25:531608use any other commands to write to the <code>&lt;notes_ref&gt;</code> tree except
1609<code>filedeleteall</code> to delete all existing notes in this tree.
Junio C Hamano15567bc2011-07-23 00:51:591610This command has two different means of specifying the content
1611of the note.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:591612<div class="dlist"><dl>
1613<dt class="hdlist1">
Junio C Hamano3b70d3c2009-11-21 17:37:371614External data format
1615</dt>
1616<dd>
1617<p>
1618 The data content for the note was already supplied by a prior
Junio C Hamanoc14e6ad2014-10-31 20:25:531619 <code>blob</code> command. The frontend just needs to connect it to the
Junio C Hamano3b70d3c2009-11-21 17:37:371620 commit that is to be annotated.
1621</p>
1622<div class="literalblock">
1623<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:531624<pre><code> 'N' SP &lt;dataref&gt; SP &lt;commit-ish&gt; LF</code></pre>
Junio C Hamano3b70d3c2009-11-21 17:37:371625</div></div>
Junio C Hamanoc14e6ad2014-10-31 20:25:531626<div class="paragraph"><p>Here <code>&lt;dataref&gt;</code> can be either a mark reference (<code>:&lt;idnum&gt;</code>)
1627set by a prior <code>blob</code> command, or a full 40-byte SHA-1 of an
Junio C Hamano3b70d3c2009-11-21 17:37:371628existing Git blob object.</p></div>
1629</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591630<dt class="hdlist1">
Junio C Hamano3b70d3c2009-11-21 17:37:371631Inline data format
1632</dt>
1633<dd>
1634<p>
1635 The data content for the note has not been supplied yet.
1636 The frontend wants to supply it as part of this modify
1637 command.
1638</p>
1639<div class="literalblock">
1640<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:531641<pre><code> 'N' SP 'inline' SP &lt;commit-ish&gt; LF
1642 data</code></pre>
Junio C Hamano3b70d3c2009-11-21 17:37:371643</div></div>
Junio C Hamanoc14e6ad2014-10-31 20:25:531644<div class="paragraph"><p>See below for a detailed description of the <code>data</code> command.</p></div>
Junio C Hamano3b70d3c2009-11-21 17:37:371645</dd>
1646</dl></div>
Junio C Hamanoc14e6ad2014-10-31 20:25:531647<div class="paragraph"><p>In both formats <code>&lt;commit-ish&gt;</code> is any of the commit specification
1648expressions also accepted by <code>from</code> (see above).</p></div>
Junio C Hamano9d971152012-12-19 00:43:111649</div>
1650</div>
1651<div class="sect2">
Junio C Hamanoc14e6ad2014-10-31 20:25:531652<h3 id="_code_mark_code"><code>mark</code></h3>
Junio C Hamano68cf15a2010-11-06 01:01:591653<div class="paragraph"><p>Arranges for fast-import to save a reference to the current object, allowing
Junio C Hamanodf60f442007-02-07 05:52:371654the frontend to recall this object at a future point in time, without
1655knowing its SHA-1. Here the current object is the object creation
Junio C Hamanoc14e6ad2014-10-31 20:25:531656command the <code>mark</code> command appears within. This can be <code>commit</code>,
1657<code>tag</code>, and <code>blob</code>, but <code>commit</code> is the most common usage.</p></div>
Junio C Hamanodf60f442007-02-07 05:52:371658<div class="literalblock">
1659<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:531660<pre><code> 'mark' SP ':' &lt;idnum&gt; LF</code></pre>
Junio C Hamanodf60f442007-02-07 05:52:371661</div></div>
Junio C Hamanoc14e6ad2014-10-31 20:25:531662<div class="paragraph"><p>where <code>&lt;idnum&gt;</code> is the number assigned by the frontend to this mark.
1663The value of <code>&lt;idnum&gt;</code> is expressed as an ASCII decimal integer.
Junio C Hamanodf60f442007-02-07 05:52:371664The value 0 is reserved and cannot be used as
Junio C Hamanoba4b9282008-07-06 05:20:311665a mark. Only values greater than or equal to 1 may be used as marks.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:591666<div class="paragraph"><p>New marks are created automatically. Existing marks can be moved
Junio C Hamanoc14e6ad2014-10-31 20:25:531667to another object simply by reusing the same <code>&lt;idnum&gt;</code> in another
1668<code>mark</code> command.</p></div>
Junio C Hamano9d971152012-12-19 00:43:111669</div>
1670<div class="sect2">
Junio C Hamanoc14e6ad2014-10-31 20:25:531671<h3 id="_code_tag_code"><code>tag</code></h3>
Junio C Hamano68cf15a2010-11-06 01:01:591672<div class="paragraph"><p>Creates an annotated tag referring to a specific commit. To create
Junio C Hamanoc14e6ad2014-10-31 20:25:531673lightweight (non-annotated) tags see the <code>reset</code> command below.</p></div>
Junio C Hamanodf60f442007-02-07 05:52:371674<div class="literalblock">
1675<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:531676<pre><code> 'tag' SP &lt;name&gt; LF
Junio C Hamanoe6f28d02013-09-17 21:34:001677 'from' SP &lt;commit-ish&gt; LF
Junio C Hamano6d325df2010-01-01 00:02:471678 'tagger' (SP &lt;name&gt;)? SP LT &lt;email&gt; GT SP &lt;when&gt; LF
Junio C Hamanoc14e6ad2014-10-31 20:25:531679 data</code></pre>
Junio C Hamanodf60f442007-02-07 05:52:371680</div></div>
Junio C Hamanoc14e6ad2014-10-31 20:25:531681<div class="paragraph"><p>where <code>&lt;name&gt;</code> is the name of the tag to create.</p></div>
1682<div class="paragraph"><p>Tag names are automatically prefixed with <code>refs/tags/</code> when stored
1683in Git, so importing the CVS branch symbol <code>RELENG-1_0-FINAL</code> would
1684use just <code>RELENG-1_0-FINAL</code> for <code>&lt;name&gt;</code>, and fast-import will write the
1685corresponding ref as <code>refs/tags/RELENG-1_0-FINAL</code>.</p></div>
1686<div class="paragraph"><p>The value of <code>&lt;name&gt;</code> must be a valid refname in Git and therefore
1687may contain forward slashes. As <code>LF</code> is not valid in a Git refname,
Junio C Hamanoba4b9282008-07-06 05:20:311688no quoting or escaping syntax is supported here.</p></div>
Junio C Hamanoc14e6ad2014-10-31 20:25:531689<div class="paragraph"><p>The <code>from</code> command is the same as in the <code>commit</code> command; see
Junio C Hamanoba4b9282008-07-06 05:20:311690above for details.</p></div>
Junio C Hamanoc14e6ad2014-10-31 20:25:531691<div class="paragraph"><p>The <code>tagger</code> command uses the same format as <code>committer</code> within
1692<code>commit</code>; again see above for details.</p></div>
1693<div class="paragraph"><p>The <code>data</code> command following <code>tagger</code> must supply the annotated tag
1694message (see below for <code>data</code> command syntax). To import an empty
Junio C Hamanodf60f442007-02-07 05:52:371695tag message use a 0 length data. Tag messages are free-form and are
1696not interpreted by Git. Currently they must be encoded in UTF-8,
Junio C Hamanoba4b9282008-07-06 05:20:311697as fast-import does not permit other encodings to be specified.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:591698<div class="paragraph"><p>Signing annotated tags during import from within fast-import is not
Junio C Hamanodf60f442007-02-07 05:52:371699supported. Trying to include your own PGP/GPG signature is not
1700recommended, as the frontend does not (easily) have access to the
1701complete set of bytes which normally goes into such a signature.
Junio C Hamanod3339982007-02-09 08:38:481702If signing is required, create lightweight tags from within fast-import with
Junio C Hamanoc14e6ad2014-10-31 20:25:531703<code>reset</code>, then create the annotated versions of those tags offline
Junio C Hamano1aa40d22010-01-21 17:46:431704with the standard <em>git tag</em> process.</p></div>
Junio C Hamano9d971152012-12-19 00:43:111705</div>
1706<div class="sect2">
Junio C Hamanoc14e6ad2014-10-31 20:25:531707<h3 id="_code_reset_code"><code>reset</code></h3>
Junio C Hamano68cf15a2010-11-06 01:01:591708<div class="paragraph"><p>Creates (or recreates) the named branch, optionally starting from
Junio C Hamanodf60f442007-02-07 05:52:371709a specific revision. The reset command allows a frontend to issue
Junio C Hamanoc14e6ad2014-10-31 20:25:531710a new <code>from</code> command for an existing branch, or to create a new
Junio C Hamanoba4b9282008-07-06 05:20:311711branch from an existing commit without creating a new commit.</p></div>
Junio C Hamanodf60f442007-02-07 05:52:371712<div class="literalblock">
1713<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:531714<pre><code> 'reset' SP &lt;ref&gt; LF
Junio C Hamanoe6f28d02013-09-17 21:34:001715 ('from' SP &lt;commit-ish&gt; LF)?
Junio C Hamanoc14e6ad2014-10-31 20:25:531716 LF?</code></pre>
Junio C Hamanodf60f442007-02-07 05:52:371717</div></div>
Junio C Hamanoc14e6ad2014-10-31 20:25:531718<div class="paragraph"><p>For a detailed description of <code>&lt;ref&gt;</code> and <code>&lt;commit-ish&gt;</code> see above
1719under <code>commit</code> and <code>from</code>.</p></div>
1720<div class="paragraph"><p>The <code>LF</code> after the command is optional (it used to be required).</p></div>
1721<div class="paragraph"><p>The <code>reset</code> command can also be used to create lightweight
Junio C Hamanoba4b9282008-07-06 05:20:311722(non-annotated) tags. For example:</p></div>
Junio C Hamanodf60f442007-02-07 05:52:371723<div class="exampleblock">
Junio C Hamano9d971152012-12-19 00:43:111724<div class="content">
Junio C Hamanodf60f442007-02-07 05:52:371725<div class="literalblock">
1726<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:531727<pre><code>reset refs/tags/938
1728from :938</code></pre>
Junio C Hamanodf60f442007-02-07 05:52:371729</div></div>
1730</div></div>
Junio C Hamanoc14e6ad2014-10-31 20:25:531731<div class="paragraph"><p>would create the lightweight tag <code>refs/tags/938</code> referring to
1732whatever commit mark <code>:938</code> references.</p></div>
Junio C Hamano9d971152012-12-19 00:43:111733</div>
1734<div class="sect2">
Junio C Hamanoc14e6ad2014-10-31 20:25:531735<h3 id="_code_blob_code"><code>blob</code></h3>
Junio C Hamano68cf15a2010-11-06 01:01:591736<div class="paragraph"><p>Requests writing one file revision to the packfile. The revision
Junio C Hamanodf60f442007-02-07 05:52:371737is not connected to any commit; this connection must be formed in
Junio C Hamanoc14e6ad2014-10-31 20:25:531738a subsequent <code>commit</code> command by referencing the blob through an
Junio C Hamanoba4b9282008-07-06 05:20:311739assigned mark.</p></div>
Junio C Hamanodf60f442007-02-07 05:52:371740<div class="literalblock">
1741<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:531742<pre><code> 'blob' LF
Junio C Hamanodf60f442007-02-07 05:52:371743 mark?
Junio C Hamanoc14e6ad2014-10-31 20:25:531744 data</code></pre>
Junio C Hamanodf60f442007-02-07 05:52:371745</div></div>
Junio C Hamano68cf15a2010-11-06 01:01:591746<div class="paragraph"><p>The mark command is optional here as some frontends have chosen
Junio C Hamanodf60f442007-02-07 05:52:371747to generate the Git SHA-1 for the blob on their own, and feed that
Junio C Hamanoc14e6ad2014-10-31 20:25:531748directly to <code>commit</code>. This is typically more work than it&#8217;s worth
Junio C Hamanoba4b9282008-07-06 05:20:311749however, as marks are inexpensive to store and easy to use.</p></div>
Junio C Hamano9d971152012-12-19 00:43:111750</div>
1751<div class="sect2">
Junio C Hamanoc14e6ad2014-10-31 20:25:531752<h3 id="_code_data_code"><code>data</code></h3>
Junio C Hamano68cf15a2010-11-06 01:01:591753<div class="paragraph"><p>Supplies raw data (for use as blob/file content, commit messages, or
Junio C Hamanod3339982007-02-09 08:38:481754annotated tag messages) to fast-import. Data can be supplied using an exact
Junio C Hamanodf60f442007-02-07 05:52:371755byte count or delimited with a terminating line. Real frontends
1756intended for production-quality conversions should always use the
1757exact byte count format, as it is more robust and performs better.
Junio C Hamanoba4b9282008-07-06 05:20:311758The delimited format is intended primarily for testing fast-import.</p></div>
Junio C Hamanoc14e6ad2014-10-31 20:25:531759<div class="paragraph"><p>Comment lines appearing within the <code>&lt;raw&gt;</code> part of <code>data</code> commands
Junio C Hamanoe52cf782007-08-19 19:15:521760are always taken to be part of the body of the data and are therefore
1761never ignored by fast-import. This makes it safe to import any
Junio C Hamanoc14e6ad2014-10-31 20:25:531762file/message content whose lines might start with <code>#</code>.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:591763<div class="dlist"><dl>
1764<dt class="hdlist1">
Junio C Hamanodf60f442007-02-07 05:52:371765Exact byte count format
1766</dt>
1767<dd>
1768<p>
1769 The frontend must specify the number of bytes of data.
1770</p>
1771<div class="literalblock">
1772<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:531773<pre><code> 'data' SP &lt;count&gt; LF
1774 &lt;raw&gt; LF?</code></pre>
Junio C Hamanodf60f442007-02-07 05:52:371775</div></div>
Junio C Hamanoc14e6ad2014-10-31 20:25:531776<div class="paragraph"><p>where <code>&lt;count&gt;</code> is the exact number of bytes appearing within
1777<code>&lt;raw&gt;</code>. The value of <code>&lt;count&gt;</code> is expressed as an ASCII decimal
1778integer. The <code>LF</code> on either side of <code>&lt;raw&gt;</code> is not
1779included in <code>&lt;count&gt;</code> and will not be included in the imported data.</p></div>
1780<div class="paragraph"><p>The <code>LF</code> after <code>&lt;raw&gt;</code> is optional (it used to be required) but
Junio C Hamanoe52cf782007-08-19 19:15:521781recommended. Always including it makes debugging a fast-import
1782stream easier as the next command always starts in column 0
Junio C Hamanoc14e6ad2014-10-31 20:25:531783of the next line, even if <code>&lt;raw&gt;</code> did not end with an <code>LF</code>.</p></div>
Junio C Hamanodf60f442007-02-07 05:52:371784</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591785<dt class="hdlist1">
Junio C Hamanodf60f442007-02-07 05:52:371786Delimited format
1787</dt>
1788<dd>
1789<p>
1790 A delimiter string is used to mark the end of the data.
Junio C Hamanod3339982007-02-09 08:38:481791 fast-import will compute the length by searching for the delimiter.
Junio C Hamanoa6387422007-08-25 03:54:271792 This format is primarily useful for testing and is not
Junio C Hamanodf60f442007-02-07 05:52:371793 recommended for real data.
1794</p>
1795<div class="literalblock">
1796<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:531797<pre><code> 'data' SP '&lt;&lt;' &lt;delim&gt; LF
Junio C Hamanodf60f442007-02-07 05:52:371798 &lt;raw&gt; LF
Junio C Hamanoe52cf782007-08-19 19:15:521799 &lt;delim&gt; LF
Junio C Hamanoc14e6ad2014-10-31 20:25:531800 LF?</code></pre>
Junio C Hamanodf60f442007-02-07 05:52:371801</div></div>
Junio C Hamanoc14e6ad2014-10-31 20:25:531802<div class="paragraph"><p>where <code>&lt;delim&gt;</code> is the chosen delimiter string. The string <code>&lt;delim&gt;</code>
1803must not appear on a line by itself within <code>&lt;raw&gt;</code>, as otherwise
1804fast-import will think the data ends earlier than it really does. The <code>LF</code>
1805immediately trailing <code>&lt;raw&gt;</code> is part of <code>&lt;raw&gt;</code>. This is one of
Junio C Hamanodf60f442007-02-07 05:52:371806the limitations of the delimited format, it is impossible to supply
Junio C Hamanoba4b9282008-07-06 05:20:311807a data chunk which does not have an LF as its last byte.</p></div>
Junio C Hamanoc14e6ad2014-10-31 20:25:531808<div class="paragraph"><p>The <code>LF</code> after <code>&lt;delim&gt; LF</code> is optional (it used to be required).</p></div>
Junio C Hamanodf60f442007-02-07 05:52:371809</dd>
Junio C Hamanoba4b9282008-07-06 05:20:311810</dl></div>
Junio C Hamano9d971152012-12-19 00:43:111811</div>
1812<div class="sect2">
Junio C Hamanoc14e6ad2014-10-31 20:25:531813<h3 id="_code_checkpoint_code"><code>checkpoint</code></h3>
Junio C Hamano68cf15a2010-11-06 01:01:591814<div class="paragraph"><p>Forces fast-import to close the current packfile, start a new one, and to
Junio C Hamanoba4b9282008-07-06 05:20:311815save out all current branch refs, tags and marks.</p></div>
Junio C Hamanodf60f442007-02-07 05:52:371816<div class="literalblock">
1817<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:531818<pre><code> 'checkpoint' LF
1819 LF?</code></pre>
Junio C Hamanodf60f442007-02-07 05:52:371820</div></div>
Junio C Hamano68cf15a2010-11-06 01:01:591821<div class="paragraph"><p>Note that fast-import automatically switches packfiles when the current
Junio C Hamanodfc4ce72007-02-07 23:17:291822packfile reaches --max-pack-size, or 4 GiB, whichever limit is
Junio C Hamanod3339982007-02-09 08:38:481823smaller. During an automatic packfile switch fast-import does not update
Junio C Hamanoba4b9282008-07-06 05:20:311824the branch refs, tags or marks.</p></div>
Junio C Hamanoc14e6ad2014-10-31 20:25:531825<div class="paragraph"><p>As a <code>checkpoint</code> can require a significant amount of CPU time and
Junio C Hamanodfc4ce72007-02-07 23:17:291826disk IO (to compute the overall pack SHA-1 checksum, generate the
1827corresponding index file, and update the refs) it can easily take
Junio C Hamanoc14e6ad2014-10-31 20:25:531828several minutes for a single <code>checkpoint</code> command to complete.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:591829<div class="paragraph"><p>Frontends may choose to issue checkpoints during extremely large
Junio C Hamanodfc4ce72007-02-07 23:17:291830and long running imports, or when they need to allow another Git
1831process access to a branch. However given that a 30 GiB Subversion
Junio C Hamanod3339982007-02-09 08:38:481832repository can be loaded into Git through fast-import in about 3 hours,
Junio C Hamanoba4b9282008-07-06 05:20:311833explicit checkpointing may not be necessary.</p></div>
Junio C Hamanoc14e6ad2014-10-31 20:25:531834<div class="paragraph"><p>The <code>LF</code> after the command is optional (it used to be required).</p></div>
Junio C Hamano9d971152012-12-19 00:43:111835</div>
1836<div class="sect2">
Junio C Hamanoc14e6ad2014-10-31 20:25:531837<h3 id="_code_progress_code"><code>progress</code></h3>
1838<div class="paragraph"><p>Causes fast-import to print the entire <code>progress</code> line unmodified to
Junio C Hamanoe52cf782007-08-19 19:15:521839its standard output channel (file descriptor 1) when the command is
1840processed from the input stream. The command otherwise has no impact
Junio C Hamano68cf15a2010-11-06 01:01:591841on the current import, or on any of fast-import&#8217;s internal state.</p></div>
Junio C Hamanoe52cf782007-08-19 19:15:521842<div class="literalblock">
1843<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:531844<pre><code> 'progress' SP &lt;any&gt; LF
1845 LF?</code></pre>
Junio C Hamanoe52cf782007-08-19 19:15:521846</div></div>
Junio C Hamanoc14e6ad2014-10-31 20:25:531847<div class="paragraph"><p>The <code>&lt;any&gt;</code> part of the command may contain any sequence of bytes
1848that does not contain <code>LF</code>. The <code>LF</code> after the command is optional.
Junio C Hamanoe52cf782007-08-19 19:15:521849Callers may wish to process the output through a tool such as sed to
Junio C Hamanoba4b9282008-07-06 05:20:311850remove the leading part of the line, for example:</p></div>
Junio C Hamanoe52cf782007-08-19 19:15:521851<div class="exampleblock">
Junio C Hamano9d971152012-12-19 00:43:111852<div class="content">
Junio C Hamanoe52cf782007-08-19 19:15:521853<div class="literalblock">
1854<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:531855<pre><code>frontend | git fast-import | sed 's/^progress //'</code></pre>
Junio C Hamanoe52cf782007-08-19 19:15:521856</div></div>
1857</div></div>
Junio C Hamanoc14e6ad2014-10-31 20:25:531858<div class="paragraph"><p>Placing a <code>progress</code> command immediately after a <code>checkpoint</code> will
1859inform the reader when the <code>checkpoint</code> has been completed and it
Junio C Hamanoba4b9282008-07-06 05:20:311860can safely access the refs that fast-import updated.</p></div>
Junio C Hamano9d971152012-12-19 00:43:111861</div>
1862<div class="sect2">
Junio C Hamanoc14e6ad2014-10-31 20:25:531863<h3 id="_code_cat_blob_code"><code>cat-blob</code></h3>
Junio C Hamano0d75e872010-12-17 06:57:261864<div class="paragraph"><p>Causes fast-import to print a blob to a file descriptor previously
Junio C Hamanoc14e6ad2014-10-31 20:25:531865arranged with the <code>--cat-blob-fd</code> argument. The command otherwise
Junio C Hamano0d75e872010-12-17 06:57:261866has no impact on the current import; its main purpose is to
1867retrieve blobs that may be in fast-import&#8217;s memory but not
1868accessible from the target repository.</p></div>
1869<div class="literalblock">
1870<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:531871<pre><code> 'cat-blob' SP &lt;dataref&gt; LF</code></pre>
Junio C Hamano0d75e872010-12-17 06:57:261872</div></div>
Junio C Hamanoc14e6ad2014-10-31 20:25:531873<div class="paragraph"><p>The <code>&lt;dataref&gt;</code> can be either a mark reference (<code>:&lt;idnum&gt;</code>)
Junio C Hamano0d75e872010-12-17 06:57:261874set previously or a full 40-byte SHA-1 of a Git blob, preexisting or
1875ready to be written.</p></div>
Junio C Hamanoc14e6ad2014-10-31 20:25:531876<div class="paragraph"><p>Output uses the same format as <code>git cat-file --batch</code>:</p></div>
Junio C Hamano0d75e872010-12-17 06:57:261877<div class="exampleblock">
Junio C Hamano9d971152012-12-19 00:43:111878<div class="content">
Junio C Hamano0d75e872010-12-17 06:57:261879<div class="literalblock">
1880<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:531881<pre><code>&lt;sha1&gt; SP 'blob' SP &lt;size&gt; LF
1882&lt;contents&gt; LF</code></pre>
Junio C Hamano0d75e872010-12-17 06:57:261883</div></div>
1884</div></div>
1885<div class="paragraph"><p>This command can be used anywhere in the stream that comments are
Junio C Hamanoc14e6ad2014-10-31 20:25:531886accepted. In particular, the <code>cat-blob</code> command can be used in the
1887middle of a commit but not in the middle of a <code>data</code> command.</p></div>
Junio C Hamano4eda1362012-04-23 20:55:491888<div class="paragraph"><p>See &#8220;Responses To Commands&#8221; below for details about how to read
1889this output safely.</p></div>
Junio C Hamano9d971152012-12-19 00:43:111890</div>
1891<div class="sect2">
Junio C Hamanoc14e6ad2014-10-31 20:25:531892<h3 id="_code_ls_code"><code>ls</code></h3>
Junio C Hamano73d10512011-03-01 01:02:381893<div class="paragraph"><p>Prints information about the object at a path to a file descriptor
Junio C Hamanoc14e6ad2014-10-31 20:25:531894previously arranged with the <code>--cat-blob-fd</code> argument. This allows
1895printing a blob from the active commit (with <code>cat-blob</code>) or copying a
Junio C Hamano73d10512011-03-01 01:02:381896blob or tree from a previous commit for use in the current one (with
Junio C Hamanoc14e6ad2014-10-31 20:25:531897<code>filemodify</code>).</p></div>
1898<div class="paragraph"><p>The <code>ls</code> command can be used anywhere in the stream that comments are
Junio C Hamano73d10512011-03-01 01:02:381899accepted, including the middle of a commit.</p></div>
1900<div class="dlist"><dl>
1901<dt class="hdlist1">
1902Reading from the active commit
1903</dt>
1904<dd>
1905<p>
Junio C Hamanoc14e6ad2014-10-31 20:25:531906 This form can only be used in the middle of a <code>commit</code>.
Junio C Hamano73d10512011-03-01 01:02:381907 The path names a directory entry within fast-import&#8217;s
1908 active commit. The path must be quoted in this case.
1909</p>
1910<div class="literalblock">
1911<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:531912<pre><code> 'ls' SP &lt;path&gt; LF</code></pre>
Junio C Hamano73d10512011-03-01 01:02:381913</div></div>
1914</dd>
1915<dt class="hdlist1">
1916Reading from a named tree
1917</dt>
1918<dd>
1919<p>
Junio C Hamanoc14e6ad2014-10-31 20:25:531920 The <code>&lt;dataref&gt;</code> can be a mark reference (<code>:&lt;idnum&gt;</code>) or the
Junio C Hamano73d10512011-03-01 01:02:381921 full 40-byte SHA-1 of a Git tag, commit, or tree object,
1922 preexisting or waiting to be written.
1923 The path is relative to the top level of the tree
Junio C Hamanoc14e6ad2014-10-31 20:25:531924 named by <code>&lt;dataref&gt;</code>.
Junio C Hamano73d10512011-03-01 01:02:381925</p>
1926<div class="literalblock">
1927<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:531928<pre><code> 'ls' SP &lt;dataref&gt; SP &lt;path&gt; LF</code></pre>
Junio C Hamano73d10512011-03-01 01:02:381929</div></div>
1930</dd>
1931</dl></div>
Junio C Hamanoc14e6ad2014-10-31 20:25:531932<div class="paragraph"><p>See <code>filemodify</code> above for a detailed description of <code>&lt;path&gt;</code>.</p></div>
1933<div class="paragraph"><p>Output uses the same format as <code>git ls-tree &lt;tree&gt; -- &lt;path&gt;</code>:</p></div>
Junio C Hamano73d10512011-03-01 01:02:381934<div class="exampleblock">
Junio C Hamano9d971152012-12-19 00:43:111935<div class="content">
Junio C Hamano73d10512011-03-01 01:02:381936<div class="literalblock">
1937<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:531938<pre><code>&lt;mode&gt; SP ('blob' | 'tree' | 'commit') SP &lt;dataref&gt; HT &lt;path&gt; LF</code></pre>
Junio C Hamano73d10512011-03-01 01:02:381939</div></div>
1940</div></div>
1941<div class="paragraph"><p>The &lt;dataref&gt; represents the blob, tree, or commit object at &lt;path&gt;
1942and can be used in later <em>cat-blob</em>, <em>filemodify</em>, or <em>ls</em> commands.</p></div>
1943<div class="paragraph"><p>If there is no file or subtree at that path, <em>git fast-import</em> will
1944instead report</p></div>
1945<div class="exampleblock">
Junio C Hamano9d971152012-12-19 00:43:111946<div class="content">
Junio C Hamano73d10512011-03-01 01:02:381947<div class="literalblock">
1948<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:531949<pre><code>missing SP &lt;path&gt; LF</code></pre>
Junio C Hamano73d10512011-03-01 01:02:381950</div></div>
1951</div></div>
Junio C Hamano4eda1362012-04-23 20:55:491952<div class="paragraph"><p>See &#8220;Responses To Commands&#8221; below for details about how to read
1953this output safely.</p></div>
Junio C Hamano9d971152012-12-19 00:43:111954</div>
1955<div class="sect2">
Junio C Hamanoc14e6ad2014-10-31 20:25:531956<h3 id="_code_feature_code"><code>feature</code></h3>
Junio C Hamano68cf15a2010-11-06 01:01:591957<div class="paragraph"><p>Require that fast-import supports the specified feature, or abort if
Junio C Hamano6ce6b6c2010-01-18 01:25:501958it does not.</p></div>
1959<div class="literalblock">
1960<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:531961<pre><code> 'feature' SP &lt;feature&gt; ('=' &lt;argument&gt;)? LF</code></pre>
Junio C Hamano6ce6b6c2010-01-18 01:25:501962</div></div>
Junio C Hamano0d75e872010-12-17 06:57:261963<div class="paragraph"><p>The &lt;feature&gt; part of the command may be any one of the following:</p></div>
1964<div class="dlist"><dl>
1965<dt class="hdlist1">
Junio C Hamano6ce6b6c2010-01-18 01:25:501966date-format
Junio C Hamano0d75e872010-12-17 06:57:261967</dt>
1968<dt class="hdlist1">
Junio C Hamano6ce6b6c2010-01-18 01:25:501969export-marks
Junio C Hamano0d75e872010-12-17 06:57:261970</dt>
1971<dt class="hdlist1">
Junio C Hamano6ce6b6c2010-01-18 01:25:501972relative-marks
Junio C Hamano0d75e872010-12-17 06:57:261973</dt>
1974<dt class="hdlist1">
Junio C Hamano6ce6b6c2010-01-18 01:25:501975no-relative-marks
Junio C Hamano0d75e872010-12-17 06:57:261976</dt>
1977<dt class="hdlist1">
Junio C Hamano6ce6b6c2010-01-18 01:25:501978force
Junio C Hamano0d75e872010-12-17 06:57:261979</dt>
1980<dd>
1981<p>
1982 Act as though the corresponding command-line option with
1983 a leading <em>--</em> was passed on the command line
1984 (see OPTIONS, above).
Junio C Hamano6ce6b6c2010-01-18 01:25:501985</p>
Junio C Hamano0d75e872010-12-17 06:57:261986</dd>
1987<dt class="hdlist1">
1988import-marks
1989</dt>
Junio C Hamanod8fa0222011-08-26 16:18:151990<dt class="hdlist1">
1991import-marks-if-exists
1992</dt>
Junio C Hamano0d75e872010-12-17 06:57:261993<dd>
1994<p>
1995 Like --import-marks except in two respects: first, only one
Junio C Hamanod8fa0222011-08-26 16:18:151996 "feature import-marks" or "feature import-marks-if-exists"
1997 command is allowed per stream; second, an --import-marks=
1998 or --import-marks-if-exists command-line option overrides
1999 any of these "feature" commands in the stream; third,
2000 "feature import-marks-if-exists" like a corresponding
2001 command-line option silently skips a nonexistent file.
Junio C Hamano0d75e872010-12-17 06:57:262002</p>
2003</dd>
2004<dt class="hdlist1">
2005cat-blob
2006</dt>
Junio C Hamano73d10512011-03-01 01:02:382007<dt class="hdlist1">
2008ls
2009</dt>
Junio C Hamano0d75e872010-12-17 06:57:262010<dd>
2011<p>
Junio C Hamano73d10512011-03-01 01:02:382012 Require that the backend support the <em>cat-blob</em> or <em>ls</em> command.
2013 Versions of fast-import not supporting the specified command
2014 will exit with a message indicating so.
Junio C Hamano0d75e872010-12-17 06:57:262015 This lets the import error out early with a clear message,
2016 rather than wasting time on the early part of an import
2017 before the unsupported command is detected.
2018</p>
2019</dd>
Junio C Hamano23e3f532011-02-10 02:05:292020<dt class="hdlist1">
2021notes
2022</dt>
2023<dd>
2024<p>
2025 Require that the backend support the <em>notemodify</em> (N)
2026 subcommand to the <em>commit</em> command.
2027 Versions of fast-import not supporting notes will exit
2028 with a message indicating so.
2029</p>
2030</dd>
Junio C Hamanofbc773c2011-08-02 00:09:122031<dt class="hdlist1">
2032done
2033</dt>
2034<dd>
2035<p>
2036 Error out if the stream ends without a <em>done</em> command.
2037 Without this feature, errors causing the frontend to end
2038 abruptly at a convenient point in the stream can go
Junio C Hamano8ce35d72012-09-18 22:30:422039 undetected. This may occur, for example, if an import
2040 front end dies in mid-operation without emitting SIGTERM
2041 or SIGKILL at its subordinate git fast-import instance.
Junio C Hamanofbc773c2011-08-02 00:09:122042</p>
2043</dd>
Junio C Hamano0d75e872010-12-17 06:57:262044</dl></div>
Junio C Hamano9d971152012-12-19 00:43:112045</div>
2046<div class="sect2">
Junio C Hamanoc14e6ad2014-10-31 20:25:532047<h3 id="_code_option_code"><code>option</code></h3>
Junio C Hamano68cf15a2010-11-06 01:01:592048<div class="paragraph"><p>Processes the specified option so that git fast-import behaves in a
2049way that suits the frontend&#8217;s needs.
Junio C Hamano6ce6b6c2010-01-18 01:25:502050Note that options specified by the frontend are overridden by any
2051options the user may specify to git fast-import itself.</p></div>
2052<div class="literalblock">
2053<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:532054<pre><code> 'option' SP &lt;option&gt; LF</code></pre>
Junio C Hamano6ce6b6c2010-01-18 01:25:502055</div></div>
Junio C Hamanoc14e6ad2014-10-31 20:25:532056<div class="paragraph"><p>The <code>&lt;option&gt;</code> part of the command may contain any of the options
Junio C Hamano6ce6b6c2010-01-18 01:25:502057listed in the OPTIONS section that do not change import semantics,
2058without the leading <em>--</em> and is treated in the same way.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:592059<div class="paragraph"><p>Option commands must be the first commands on the input (not counting
Junio C Hamano6ce6b6c2010-01-18 01:25:502060feature commands), to give an option command after any non-option
2061command is an error.</p></div>
Junio C Hamanoe1aeb5e2014-06-06 19:16:292062<div class="paragraph"><p>The following command-line options change import semantics and may therefore
Junio C Hamano6ce6b6c2010-01-18 01:25:502063not be passed as option:</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:592064<div class="ulist"><ul>
Junio C Hamano6ce6b6c2010-01-18 01:25:502065<li>
2066<p>
2067date-format
2068</p>
2069</li>
2070<li>
2071<p>
2072import-marks
2073</p>
2074</li>
2075<li>
2076<p>
2077export-marks
2078</p>
2079</li>
2080<li>
2081<p>
Junio C Hamano0d75e872010-12-17 06:57:262082cat-blob-fd
2083</p>
2084</li>
2085<li>
2086<p>
Junio C Hamano6ce6b6c2010-01-18 01:25:502087force
2088</p>
2089</li>
2090</ul></div>
Junio C Hamano9d971152012-12-19 00:43:112091</div>
2092<div class="sect2">
Junio C Hamanoc14e6ad2014-10-31 20:25:532093<h3 id="_code_done_code"><code>done</code></h3>
2094<div class="paragraph"><p>If the <code>done</code> feature is not in use, treated as if EOF was read.
Junio C Hamanofbc773c2011-08-02 00:09:122095This can be used to tell fast-import to finish early.</p></div>
Junio C Hamanoc14e6ad2014-10-31 20:25:532096<div class="paragraph"><p>If the <code>--done</code> command-line option or <code>feature done</code> command is
2097in use, the <code>done</code> command is mandatory and marks the end of the
Junio C Hamanofbc773c2011-08-02 00:09:122098stream.</p></div>
Junio C Hamanodfc4ce72007-02-07 23:17:292099</div>
Junio C Hamano9d971152012-12-19 00:43:112100</div>
2101</div>
2102<div class="sect1">
Junio C Hamano4eda1362012-04-23 20:55:492103<h2 id="_responses_to_commands">Responses To Commands</h2>
2104<div class="sectionbody">
2105<div class="paragraph"><p>New objects written by fast-import are not available immediately.
2106Most fast-import commands have no visible effect until the next
2107checkpoint (or completion). The frontend can send commands to
2108fill fast-import&#8217;s input pipe without worrying about how quickly
2109they will take effect, which improves performance by simplifying
2110scheduling.</p></div>
2111<div class="paragraph"><p>For some frontends, though, it is useful to be able to read back
2112data from the current repository as it is being updated (for
2113example when the source material describes objects in terms of
2114patches to be applied to previously imported objects). This can
2115be accomplished by connecting the frontend and fast-import via
2116bidirectional pipes:</p></div>
2117<div class="exampleblock">
Junio C Hamano9d971152012-12-19 00:43:112118<div class="content">
Junio C Hamano4eda1362012-04-23 20:55:492119<div class="literalblock">
2120<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:532121<pre><code>mkfifo fast-import-output
Junio C Hamano4eda1362012-04-23 20:55:492122frontend &lt;fast-import-output |
Junio C Hamanoc14e6ad2014-10-31 20:25:532123git fast-import &gt;fast-import-output</code></pre>
Junio C Hamano4eda1362012-04-23 20:55:492124</div></div>
2125</div></div>
Junio C Hamanoc14e6ad2014-10-31 20:25:532126<div class="paragraph"><p>A frontend set up this way can use <code>progress</code>, <code>ls</code>, and <code>cat-blob</code>
Junio C Hamano4eda1362012-04-23 20:55:492127commands to read information from the import in progress.</p></div>
2128<div class="paragraph"><p>To avoid deadlock, such frontends must completely consume any
Junio C Hamanoc14e6ad2014-10-31 20:25:532129pending output from <code>progress</code>, <code>ls</code>, and <code>cat-blob</code> before
Junio C Hamano4eda1362012-04-23 20:55:492130performing writes to fast-import that might block.</p></div>
2131</div>
Junio C Hamano9d971152012-12-19 00:43:112132</div>
2133<div class="sect1">
Junio C Hamanoba4b9282008-07-06 05:20:312134<h2 id="_crash_reports">Crash Reports</h2>
Junio C Hamano21391932008-02-16 10:02:542135<div class="sectionbody">
Junio C Hamano68cf15a2010-11-06 01:01:592136<div class="paragraph"><p>If fast-import is supplied invalid input it will terminate with a
Junio C Hamano21391932008-02-16 10:02:542137non-zero exit status and create a crash report in the top level of
2138the Git repository it was importing into. Crash reports contain
2139a snapshot of the internal fast-import state as well as the most
Junio C Hamanoba4b9282008-07-06 05:20:312140recent commands that lead up to the crash.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:592141<div class="paragraph"><p>All recent commands (including stream comments, file changes and
Junio C Hamano21391932008-02-16 10:02:542142progress commands) are shown in the command history within the crash
2143report, but raw file data and commit messages are excluded from the
2144crash report. This exclusion saves space within the report file
2145and reduces the amount of buffering that fast-import must perform
Junio C Hamanoba4b9282008-07-06 05:20:312146during execution.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:592147<div class="paragraph"><p>After writing a crash report fast-import will close the current
Junio C Hamano21391932008-02-16 10:02:542148packfile and export the marks table. This allows the frontend
2149developer to inspect the repository state and resume the import from
2150the point where it crashed. The modified branches and tags are not
2151updated during a crash, as the import did not complete successfully.
2152Branch and tag information can be found in the crash report and
Junio C Hamanoba4b9282008-07-06 05:20:312153must be applied manually if the update is needed.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:592154<div class="paragraph"><p>An example crash:</p></div>
Junio C Hamano21391932008-02-16 10:02:542155<div class="exampleblock">
Junio C Hamano9d971152012-12-19 00:43:112156<div class="content">
Junio C Hamano21391932008-02-16 10:02:542157<div class="literalblock">
2158<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:532159<pre><code>$ cat &gt;in &lt;&lt;END_OF_INPUT
Junio C Hamano21391932008-02-16 10:02:542160# my very first test commit
2161commit refs/heads/master
2162committer Shawn O. Pearce &lt;spearce&gt; 19283 -0400
2163# who is that guy anyway?
2164data &lt;&lt;EOF
2165this is my commit
2166EOF
2167M 644 inline .gitignore
2168data &lt;&lt;EOF
2169.gitignore
2170EOF
2171M 777 inline bob
Junio C Hamanoc14e6ad2014-10-31 20:25:532172END_OF_INPUT</code></pre>
Junio C Hamano21391932008-02-16 10:02:542173</div></div>
2174<div class="literalblock">
2175<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:532176<pre><code>$ git fast-import &lt;in
Junio C Hamano21391932008-02-16 10:02:542177fatal: Corrupt mode: M 777 inline bob
Junio C Hamanoc14e6ad2014-10-31 20:25:532178fast-import: dumping crash report to .git/fast_import_crash_8434</code></pre>
Junio C Hamano21391932008-02-16 10:02:542179</div></div>
2180<div class="literalblock">
2181<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:532182<pre><code>$ cat .git/fast_import_crash_8434
Junio C Hamano21391932008-02-16 10:02:542183fast-import crash report:
2184 fast-import process: 8434
2185 parent process : 1391
Junio C Hamanoc14e6ad2014-10-31 20:25:532186 at Sat Sep 1 00:58:12 2007</code></pre>
Junio C Hamano21391932008-02-16 10:02:542187</div></div>
2188<div class="literalblock">
2189<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:532190<pre><code>fatal: Corrupt mode: M 777 inline bob</code></pre>
Junio C Hamano21391932008-02-16 10:02:542191</div></div>
2192<div class="literalblock">
2193<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:532194<pre><code>Most Recent Commands Before Crash
Junio C Hamano21391932008-02-16 10:02:542195---------------------------------
2196 # my very first test commit
2197 commit refs/heads/master
2198 committer Shawn O. Pearce &lt;spearce&gt; 19283 -0400
2199 # who is that guy anyway?
2200 data &lt;&lt;EOF
2201 M 644 inline .gitignore
2202 data &lt;&lt;EOF
Junio C Hamanoc14e6ad2014-10-31 20:25:532203* M 777 inline bob</code></pre>
Junio C Hamano21391932008-02-16 10:02:542204</div></div>
2205<div class="literalblock">
2206<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:532207<pre><code>Active Branch LRU
Junio C Hamano21391932008-02-16 10:02:542208-----------------
Junio C Hamanoc14e6ad2014-10-31 20:25:532209 active_branches = 1 cur, 5 max</code></pre>
Junio C Hamano21391932008-02-16 10:02:542210</div></div>
2211<div class="literalblock">
2212<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:532213<pre><code>pos clock name
Junio C Hamano21391932008-02-16 10:02:542214~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Junio C Hamanoc14e6ad2014-10-31 20:25:532215 1) 0 refs/heads/master</code></pre>
Junio C Hamano21391932008-02-16 10:02:542216</div></div>
2217<div class="literalblock">
2218<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:532219<pre><code>Inactive Branches
Junio C Hamano21391932008-02-16 10:02:542220-----------------
2221refs/heads/master:
2222 status : active loaded dirty
2223 tip commit : 0000000000000000000000000000000000000000
2224 old tree : 0000000000000000000000000000000000000000
2225 cur tree : 0000000000000000000000000000000000000000
2226 commit clock: 0
Junio C Hamanoc14e6ad2014-10-31 20:25:532227 last pack :</code></pre>
Junio C Hamano21391932008-02-16 10:02:542228</div></div>
2229<div class="literalblock">
2230<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:532231<pre><code>-------------------
2232END OF CRASH REPORT</code></pre>
Junio C Hamano21391932008-02-16 10:02:542233</div></div>
2234</div></div>
2235</div>
Junio C Hamano9d971152012-12-19 00:43:112236</div>
2237<div class="sect1">
Junio C Hamanoba4b9282008-07-06 05:20:312238<h2 id="_tips_and_tricks">Tips and Tricks</h2>
Junio C Hamanodfc4ce72007-02-07 23:17:292239<div class="sectionbody">
Junio C Hamano68cf15a2010-11-06 01:01:592240<div class="paragraph"><p>The following tips and tricks have been collected from various
Junio C Hamanoba4b9282008-07-06 05:20:312241users of fast-import, and are offered here as suggestions.</p></div>
Junio C Hamano9d971152012-12-19 00:43:112242<div class="sect2">
2243<h3 id="_use_one_mark_per_commit">Use One Mark Per Commit</h3>
Junio C Hamano68cf15a2010-11-06 01:01:592244<div class="paragraph"><p>When doing a repository conversion, use a unique mark per commit
Junio C Hamanoc14e6ad2014-10-31 20:25:532245(<code>mark :&lt;n&gt;</code>) and supply the --export-marks option on the command
Junio C Hamanod3339982007-02-09 08:38:482246line. fast-import will dump a file which lists every mark and the Git
Junio C Hamanodfc4ce72007-02-07 23:17:292247object SHA-1 that corresponds to it. If the frontend can tie
2248the marks back to the source repository, it is easy to verify the
2249accuracy and completeness of the import by comparing each Git
Junio C Hamanoba4b9282008-07-06 05:20:312250commit to the corresponding source revision.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:592251<div class="paragraph"><p>Coming from a system such as Perforce or Subversion this should be
Junio C Hamanod3339982007-02-09 08:38:482252quite simple, as the fast-import mark can also be the Perforce changeset
Junio C Hamanoba4b9282008-07-06 05:20:312253number or the Subversion revision number.</p></div>
Junio C Hamano9d971152012-12-19 00:43:112254</div>
2255<div class="sect2">
2256<h3 id="_freely_skip_around_branches">Freely Skip Around Branches</h3>
Junio C Hamano68cf15a2010-11-06 01:01:592257<div class="paragraph"><p>Don&#8217;t bother trying to optimize the frontend to stick to one branch
Junio C Hamanodfc4ce72007-02-07 23:17:292258at a time during an import. Although doing so might be slightly
Junio C Hamanod3339982007-02-09 08:38:482259faster for fast-import, it tends to increase the complexity of the frontend
Junio C Hamanoba4b9282008-07-06 05:20:312260code considerably.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:592261<div class="paragraph"><p>The branch LRU builtin to fast-import tends to behave very well, and the
Junio C Hamanodfc4ce72007-02-07 23:17:292262cost of activating an inactive branch is so low that bouncing around
Junio C Hamanoba4b9282008-07-06 05:20:312263between branches has virtually no impact on import performance.</p></div>
Junio C Hamano9d971152012-12-19 00:43:112264</div>
2265<div class="sect2">
2266<h3 id="_handling_renames">Handling Renames</h3>
Junio C Hamano68cf15a2010-11-06 01:01:592267<div class="paragraph"><p>When importing a renamed file or directory, simply delete the old
Junio C Hamano9dd8bb02007-02-12 07:15:352268name(s) and modify the new name(s) during the corresponding commit.
2269Git performs rename detection after-the-fact, rather than explicitly
Junio C Hamanoba4b9282008-07-06 05:20:312270during a commit.</p></div>
Junio C Hamano9d971152012-12-19 00:43:112271</div>
2272<div class="sect2">
2273<h3 id="_use_tag_fixup_branches">Use Tag Fixup Branches</h3>
Junio C Hamano68cf15a2010-11-06 01:01:592274<div class="paragraph"><p>Some other SCM systems let the user create a tag from multiple
Junio C Hamanodfc4ce72007-02-07 23:17:292275files which are not from the same commit/changeset. Or to create
Junio C Hamanoba4b9282008-07-06 05:20:312276tags which are a subset of the files available in the repository.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:592277<div class="paragraph"><p>Importing these tags as-is in Git is impossible without making at
Junio C Hamano9d971152012-12-19 00:43:112278least one commit which &#8220;fixes up&#8221; the files to match the content
Junio C Hamanoc14e6ad2014-10-31 20:25:532279of the tag. Use fast-import&#8217;s <code>reset</code> command to reset a dummy branch
Junio C Hamanodfc4ce72007-02-07 23:17:292280outside of your normal branch space to the base commit for the tag,
2281then commit one or more file fixup commits, and finally tag the
Junio C Hamanoba4b9282008-07-06 05:20:312282dummy branch.</p></div>
Junio C Hamanoc14e6ad2014-10-31 20:25:532283<div class="paragraph"><p>For example since all normal branches are stored under <code>refs/heads/</code>
2284name the tag fixup branch <code>TAG_FIXUP</code>. This way it is impossible for
Junio C Hamanodfc4ce72007-02-07 23:17:292285the fixup branch used by the importer to have namespace conflicts
Junio C Hamanoc14e6ad2014-10-31 20:25:532286with real branches imported from the source (the name <code>TAG_FIXUP</code>
2287is not <code>refs/heads/TAG_FIXUP</code>).</p></div>
2288<div class="paragraph"><p>When committing fixups, consider using <code>merge</code> to connect the
Junio C Hamanodfc4ce72007-02-07 23:17:292289commit(s) which are supplying file revisions to the fixup branch.
Junio C Hamano1aa40d22010-01-21 17:46:432290Doing so will allow tools such as <em>git blame</em> to track
Junio C Hamanodfc4ce72007-02-07 23:17:292291through the real commit history and properly annotate the source
Junio C Hamanoba4b9282008-07-06 05:20:312292files.</p></div>
Junio C Hamanoc14e6ad2014-10-31 20:25:532293<div class="paragraph"><p>After fast-import terminates the frontend will need to do <code>rm .git/TAG_FIXUP</code>
Junio C Hamanoba4b9282008-07-06 05:20:312294to remove the dummy branch.</p></div>
Junio C Hamano9d971152012-12-19 00:43:112295</div>
2296<div class="sect2">
2297<h3 id="_import_now_repack_later">Import Now, Repack Later</h3>
Junio C Hamano68cf15a2010-11-06 01:01:592298<div class="paragraph"><p>As soon as fast-import completes the Git repository is completely valid
Junio C Hamanoa6387422007-08-25 03:54:272299and ready for use. Typically this takes only a very short time,
Junio C Hamanoba4b9282008-07-06 05:20:312300even for considerably large projects (100,000+ commits).</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:592301<div class="paragraph"><p>However repacking the repository is necessary to improve data
Junio C Hamanodfc4ce72007-02-07 23:17:292302locality and access performance. It can also take hours on extremely
2303large projects (especially if -f and a large --window parameter is
2304used). Since repacking is safe to run alongside readers and writers,
2305run the repack in the background and let it finish when it finishes.
Junio C Hamanoba4b9282008-07-06 05:20:312306There is no reason to wait to explore your new Git project!</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:592307<div class="paragraph"><p>If you choose to wait for the repack, don&#8217;t try to run benchmarks
Junio C Hamanod3339982007-02-09 08:38:482308or performance tests until repacking is completed. fast-import outputs
Junio C Hamanodfc4ce72007-02-07 23:17:292309suboptimal packfiles that are simply never seen in real use
Junio C Hamanoba4b9282008-07-06 05:20:312310situations.</p></div>
Junio C Hamano9d971152012-12-19 00:43:112311</div>
2312<div class="sect2">
2313<h3 id="_repacking_historical_data">Repacking Historical Data</h3>
Junio C Hamano68cf15a2010-11-06 01:01:592314<div class="paragraph"><p>If you are repacking very old imported data (e.g. older than the
Junio C Hamanodfc4ce72007-02-07 23:17:292315last year), consider expending some extra CPU time and supplying
Junio C Hamano1aa40d22010-01-21 17:46:432316--window=50 (or higher) when you run <em>git repack</em>.
Junio C Hamanodfc4ce72007-02-07 23:17:292317This will take longer, but will also produce a smaller packfile.
2318You only need to expend the effort once, and everyone using your
Junio C Hamanoba4b9282008-07-06 05:20:312319project will benefit from the smaller repository.</p></div>
Junio C Hamano9d971152012-12-19 00:43:112320</div>
2321<div class="sect2">
2322<h3 id="_include_some_progress_messages">Include Some Progress Messages</h3>
Junio C Hamanoc14e6ad2014-10-31 20:25:532323<div class="paragraph"><p>Every once in a while have your frontend emit a <code>progress</code> message
Junio C Hamanoe52cf782007-08-19 19:15:522324to fast-import. The contents of the messages are entirely free-form,
2325so one suggestion would be to output the current month and year
2326each time the current commit date moves into the next month.
2327Your users will feel better knowing how much of the data stream
Junio C Hamanoba4b9282008-07-06 05:20:312328has been processed.</p></div>
Junio C Hamanodf60f442007-02-07 05:52:372329</div>
Junio C Hamano9d971152012-12-19 00:43:112330</div>
2331</div>
2332<div class="sect1">
Junio C Hamanoba4b9282008-07-06 05:20:312333<h2 id="_packfile_optimization">Packfile Optimization</h2>
Junio C Hamanodf60f442007-02-07 05:52:372334<div class="sectionbody">
Junio C Hamano68cf15a2010-11-06 01:01:592335<div class="paragraph"><p>When packing a blob fast-import always attempts to deltify against the last
Junio C Hamanodf60f442007-02-07 05:52:372336blob written. Unless specifically arranged for by the frontend,
2337this will probably not be a prior version of the same file, so the
2338generated delta will not be the smallest possible. The resulting
Junio C Hamanoba4b9282008-07-06 05:20:312339packfile will be compressed, but will not be optimal.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:592340<div class="paragraph"><p>Frontends which have efficient access to all revisions of a
Junio C Hamanodf60f442007-02-07 05:52:372341single file (for example reading an RCS/CVS ,v file) can choose
2342to supply all revisions of that file as a sequence of consecutive
Junio C Hamanoc14e6ad2014-10-31 20:25:532343<code>blob</code> commands. This allows fast-import to deltify the different file
Junio C Hamanodf60f442007-02-07 05:52:372344revisions against each other, saving space in the final packfile.
2345Marks can be used to later identify individual file revisions during
Junio C Hamanoc14e6ad2014-10-31 20:25:532346a sequence of <code>commit</code> commands.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:592347<div class="paragraph"><p>The packfile(s) created by fast-import do not encourage good disk access
Junio C Hamanod3339982007-02-09 08:38:482348patterns. This is caused by fast-import writing the data in the order
Junio C Hamanodf60f442007-02-07 05:52:372349it is received on standard input, while Git typically organizes
2350data within packfiles to make the most recent (current tip) data
2351appear before historical data. Git also clusters commits together,
Junio C Hamanoba4b9282008-07-06 05:20:312352speeding up revision traversal through better cache locality.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:592353<div class="paragraph"><p>For this reason it is strongly recommended that users repack the
Junio C Hamanoc14e6ad2014-10-31 20:25:532354repository with <code>git repack -a -d</code> after fast-import completes, allowing
Junio C Hamanodf60f442007-02-07 05:52:372355Git to reorganize the packfiles for faster data access. If blob
Junio C Hamanoc14e6ad2014-10-31 20:25:532356deltas are suboptimal (see above) then also adding the <code>-f</code> option
Junio C Hamanodf60f442007-02-07 05:52:372357to force recomputation of all deltas can significantly reduce the
Junio C Hamanoba4b9282008-07-06 05:20:312358final packfile size (30-50% smaller can be quite typical).</p></div>
Junio C Hamanodf60f442007-02-07 05:52:372359</div>
Junio C Hamano9d971152012-12-19 00:43:112360</div>
2361<div class="sect1">
Junio C Hamanoba4b9282008-07-06 05:20:312362<h2 id="_memory_utilization">Memory Utilization</h2>
Junio C Hamanodf60f442007-02-07 05:52:372363<div class="sectionbody">
Junio C Hamano68cf15a2010-11-06 01:01:592364<div class="paragraph"><p>There are a number of factors which affect how much memory fast-import
Junio C Hamanodf60f442007-02-07 05:52:372365requires to perform an import. Like critical sections of core
Junio C Hamanoa6387422007-08-25 03:54:272366Git, fast-import uses its own memory allocators to amortize any overheads
2367associated with malloc. In practice fast-import tends to amortize any
Junio C Hamanoba4b9282008-07-06 05:20:312368malloc overheads to 0, due to its use of large block allocations.</p></div>
Junio C Hamano9d971152012-12-19 00:43:112369<div class="sect2">
2370<h3 id="_per_object">per object</h3>
Junio C Hamano68cf15a2010-11-06 01:01:592371<div class="paragraph"><p>fast-import maintains an in-memory structure for every object written in
Junio C Hamanodf60f442007-02-07 05:52:372372this execution. On a 32 bit system the structure is 32 bytes,
2373on a 64 bit system the structure is 40 bytes (due to the larger
2374pointer sizes). Objects in the table are not deallocated until
Junio C Hamanod3339982007-02-09 08:38:482375fast-import terminates. Importing 2 million objects on a 32 bit system
Junio C Hamanoba4b9282008-07-06 05:20:312376will require approximately 64 MiB of memory.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:592377<div class="paragraph"><p>The object table is actually a hashtable keyed on the object name
Junio C Hamanod3339982007-02-09 08:38:482378(the unique SHA-1). This storage configuration allows fast-import to reuse
Junio C Hamanodf60f442007-02-07 05:52:372379an existing or already written object and avoid writing duplicates
2380to the output packfile. Duplicate blobs are surprisingly common
Junio C Hamanoba4b9282008-07-06 05:20:312381in an import, typically due to branch merges in the source.</p></div>
Junio C Hamano9d971152012-12-19 00:43:112382</div>
2383<div class="sect2">
2384<h3 id="_per_mark">per mark</h3>
Junio C Hamano68cf15a2010-11-06 01:01:592385<div class="paragraph"><p>Marks are stored in a sparse array, using 1 pointer (4 bytes or 8
Junio C Hamanodf60f442007-02-07 05:52:372386bytes, depending on pointer size) per mark. Although the array
2387is sparse, frontends are still strongly encouraged to use marks
2388between 1 and n, where n is the total number of marks required for
Junio C Hamanoba4b9282008-07-06 05:20:312389this import.</p></div>
Junio C Hamano9d971152012-12-19 00:43:112390</div>
2391<div class="sect2">
2392<h3 id="_per_branch">per branch</h3>
Junio C Hamano68cf15a2010-11-06 01:01:592393<div class="paragraph"><p>Branches are classified as active and inactive. The memory usage
Junio C Hamanoba4b9282008-07-06 05:20:312394of the two classes is significantly different.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:592395<div class="paragraph"><p>Inactive branches are stored in a structure which uses 96 or 120
Junio C Hamanodf60f442007-02-07 05:52:372396bytes (32 bit or 64 bit systems, respectively), plus the length of
Junio C Hamanod3339982007-02-09 08:38:482397the branch name (typically under 200 bytes), per branch. fast-import will
Junio C Hamanodf60f442007-02-07 05:52:372398easily handle as many as 10,000 inactive branches in under 2 MiB
Junio C Hamanoba4b9282008-07-06 05:20:312399of memory.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:592400<div class="paragraph"><p>Active branches have the same overhead as inactive branches, but
Junio C Hamanodf60f442007-02-07 05:52:372401also contain copies of every tree that has been recently modified on
Junio C Hamanoc14e6ad2014-10-31 20:25:532402that branch. If subtree <code>include</code> has not been modified since the
Junio C Hamanodf60f442007-02-07 05:52:372403branch became active, its contents will not be loaded into memory,
Junio C Hamanoc14e6ad2014-10-31 20:25:532404but if subtree <code>src</code> has been modified by a commit since the branch
Junio C Hamanoba4b9282008-07-06 05:20:312405became active, then its contents will be loaded in memory.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:592406<div class="paragraph"><p>As active branches store metadata about the files contained on that
Junio C Hamanodf60f442007-02-07 05:52:372407branch, their in-memory storage size can grow to a considerable size
Junio C Hamanoba4b9282008-07-06 05:20:312408(see below).</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:592409<div class="paragraph"><p>fast-import automatically moves active branches to inactive status based on
Junio C Hamanodf60f442007-02-07 05:52:372410a simple least-recently-used algorithm. The LRU chain is updated on
Junio C Hamanoc14e6ad2014-10-31 20:25:532411each <code>commit</code> command. The maximum number of active branches can be
Junio C Hamanoba4b9282008-07-06 05:20:312412increased or decreased on the command line with --active-branches=.</p></div>
Junio C Hamano9d971152012-12-19 00:43:112413</div>
2414<div class="sect2">
2415<h3 id="_per_active_tree">per active tree</h3>
Junio C Hamano68cf15a2010-11-06 01:01:592416<div class="paragraph"><p>Trees (aka directories) use just 12 bytes of memory on top of the
Junio C Hamanodf60f442007-02-07 05:52:372417memory required for their entries (see &#8220;per active file&#8221; below).
Junio C Hamanoa6387422007-08-25 03:54:272418The cost of a tree is virtually 0, as its overhead amortizes out
Junio C Hamanoba4b9282008-07-06 05:20:312419over the individual file entries.</p></div>
Junio C Hamano9d971152012-12-19 00:43:112420</div>
2421<div class="sect2">
2422<h3 id="_per_active_file_entry">per active file entry</h3>
Junio C Hamano68cf15a2010-11-06 01:01:592423<div class="paragraph"><p>Files (and pointers to subtrees) within active trees require 52 or 64
Junio C Hamanodf60f442007-02-07 05:52:372424bytes (32/64 bit platforms) per entry. To conserve space, file and
2425tree names are pooled in a common string table, allowing the filename
2426&#8220;Makefile&#8221; to use just 16 bytes (after including the string header
Junio C Hamanoba4b9282008-07-06 05:20:312427overhead) no matter how many times it occurs within the project.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:592428<div class="paragraph"><p>The active branch LRU, when coupled with the filename string pool
Junio C Hamanod3339982007-02-09 08:38:482429and lazy loading of subtrees, allows fast-import to efficiently import
Junio C Hamanodf60f442007-02-07 05:52:372430projects with 2,000+ branches and 45,114+ files in a very limited
Junio C Hamanoba4b9282008-07-06 05:20:312431memory footprint (less than 2.7 MiB per active branch).</p></div>
Junio C Hamanodf60f442007-02-07 05:52:372432</div>
Junio C Hamano9d971152012-12-19 00:43:112433</div>
2434</div>
2435<div class="sect1">
Junio C Hamano0d75e872010-12-17 06:57:262436<h2 id="_signals">Signals</h2>
2437<div class="sectionbody">
2438<div class="paragraph"><p>Sending <strong>SIGUSR1</strong> to the <em>git fast-import</em> process ends the current
Junio C Hamanoc14e6ad2014-10-31 20:25:532439packfile early, simulating a <code>checkpoint</code> command. The impatient
Junio C Hamano0d75e872010-12-17 06:57:262440operator can use this facility to peek at the objects and refs from an
2441import in progress, at the cost of some added running time and worse
2442compression.</p></div>
2443</div>
Junio C Hamano9d971152012-12-19 00:43:112444</div>
2445<div class="sect1">
Junio C Hamano13220242014-11-19 23:06:272446<h2 id="_see_also">SEE ALSO</h2>
2447<div class="sectionbody">
2448<div class="paragraph"><p><a href="git-fast-export.html">git-fast-export(1)</a></p></div>
2449</div>
2450</div>
2451<div class="sect1">
Junio C Hamanoba4b9282008-07-06 05:20:312452<h2 id="_git">GIT</h2>
Junio C Hamanodf60f442007-02-07 05:52:372453<div class="sectionbody">
Junio C Hamanoa28a9202012-06-21 07:08:232454<div class="paragraph"><p>Part of the <a href="git.html">git(1)</a> suite</p></div>
Junio C Hamanodf60f442007-02-07 05:52:372455</div>
Junio C Hamano7bd050f2011-09-22 06:32:222456</div>
Junio C Hamano9d971152012-12-19 00:43:112457</div>
Junio C Hamano7bd050f2011-09-22 06:32:222458<div id="footnotes"><hr /></div>
Junio C Hamanodf60f442007-02-07 05:52:372459<div id="footer">
2460<div id="footer-text">
Junio C Hamano13220242014-11-19 23:06:272461Last updated 2014-11-19 15:05:50 PST
Junio C Hamanodf60f442007-02-07 05:52:372462</div>
2463</div>
2464</body>
2465</html>