Autogenerated HTML docs for v1.7.4.1-55-gdca3d
[git/jnareb-git.git] / git-fast-import.html
blobe2dbf24754372b1704f669b40be2f684a676ba8f
1 <!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>
5 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
6 <meta name="generator" content="AsciiDoc 8.4.5" />
7 <title>git-fast-import(1)</title>
8 <style type="text/css">
9 /* Debug borders */
10 p, li, dt, dd, div, pre, h1, h2, h3, h4, h5, h6 {
12 border: 1px solid red;
16 body {
17 margin: 1em 5% 1em 5%;
20 a {
21 color: blue;
22 text-decoration: underline;
24 a:visited {
25 color: fuchsia;
28 em {
29 font-style: italic;
30 color: navy;
33 strong {
34 font-weight: bold;
35 color: #083194;
38 tt {
39 color: navy;
42 h1, h2, h3, h4, h5, h6 {
43 color: #527bbd;
44 font-family: sans-serif;
45 margin-top: 1.2em;
46 margin-bottom: 0.5em;
47 line-height: 1.3;
50 h1, h2, h3 {
51 border-bottom: 2px solid silver;
53 h2 {
54 padding-top: 0.5em;
56 h3 {
57 float: left;
59 h3 + * {
60 clear: left;
63 div.sectionbody {
64 font-family: serif;
65 margin-left: 0;
68 hr {
69 border: 1px solid silver;
72 p {
73 margin-top: 0.5em;
74 margin-bottom: 0.5em;
77 ul, ol, li > p {
78 margin-top: 0;
81 pre {
82 padding: 0;
83 margin: 0;
86 span#author {
87 color: #527bbd;
88 font-family: sans-serif;
89 font-weight: bold;
90 font-size: 1.1em;
92 span#email {
94 span#revnumber, span#revdate, span#revremark {
95 font-family: sans-serif;
98 div#footer {
99 font-family: sans-serif;
100 font-size: small;
101 border-top: 2px solid silver;
102 padding-top: 0.5em;
103 margin-top: 4.0em;
105 div#footer-text {
106 float: left;
107 padding-bottom: 0.5em;
109 div#footer-badges {
110 float: right;
111 padding-bottom: 0.5em;
114 div#preamble {
115 margin-top: 1.5em;
116 margin-bottom: 1.5em;
118 div.tableblock, div.imageblock, div.exampleblock, div.verseblock,
119 div.quoteblock, div.literalblock, div.listingblock, div.sidebarblock,
120 div.admonitionblock {
121 margin-top: 1.5em;
122 margin-bottom: 1.5em;
124 div.admonitionblock {
125 margin-top: 2.5em;
126 margin-bottom: 2.5em;
129 div.content { /* Block element content. */
130 padding: 0;
133 /* Block element titles. */
134 div.title, caption.title {
135 color: #527bbd;
136 font-family: sans-serif;
137 font-weight: bold;
138 text-align: left;
139 margin-top: 1.0em;
140 margin-bottom: 0.5em;
142 div.title + * {
143 margin-top: 0;
146 td div.title:first-child {
147 margin-top: 0.0em;
149 div.content div.title:first-child {
150 margin-top: 0.0em;
152 div.content + div.title {
153 margin-top: 0.0em;
156 div.sidebarblock > div.content {
157 background: #ffffee;
158 border: 1px solid silver;
159 padding: 0.5em;
162 div.listingblock > div.content {
163 border: 1px solid silver;
164 background: #f4f4f4;
165 padding: 0.5em;
168 div.quoteblock {
169 padding-left: 2.0em;
170 margin-right: 10%;
172 div.quoteblock > div.attribution {
173 padding-top: 0.5em;
174 text-align: right;
177 div.verseblock {
178 padding-left: 2.0em;
179 margin-right: 10%;
181 div.verseblock > div.content {
182 white-space: pre;
184 div.verseblock > div.attribution {
185 padding-top: 0.75em;
186 text-align: left;
188 /* DEPRECATED: Pre version 8.2.7 verse style literal block. */
189 div.verseblock + div.attribution {
190 text-align: left;
193 div.admonitionblock .icon {
194 vertical-align: top;
195 font-size: 1.1em;
196 font-weight: bold;
197 text-decoration: underline;
198 color: #527bbd;
199 padding-right: 0.5em;
201 div.admonitionblock td.content {
202 padding-left: 0.5em;
203 border-left: 2px solid silver;
206 div.exampleblock > div.content {
207 border-left: 2px solid silver;
208 padding: 0.5em;
211 div.imageblock div.content { padding-left: 0; }
212 span.image img { border-style: none; }
213 a.image:visited { color: white; }
215 dl {
216 margin-top: 0.8em;
217 margin-bottom: 0.8em;
219 dt {
220 margin-top: 0.5em;
221 margin-bottom: 0;
222 font-style: normal;
223 color: navy;
225 dd > *:first-child {
226 margin-top: 0.1em;
229 ul, ol {
230 list-style-position: outside;
232 ol.arabic {
233 list-style-type: decimal;
235 ol.loweralpha {
236 list-style-type: lower-alpha;
238 ol.upperalpha {
239 list-style-type: upper-alpha;
241 ol.lowerroman {
242 list-style-type: lower-roman;
244 ol.upperroman {
245 list-style-type: upper-roman;
248 div.compact ul, div.compact ol,
249 div.compact p, div.compact p,
250 div.compact div, div.compact div {
251 margin-top: 0.1em;
252 margin-bottom: 0.1em;
255 div.tableblock > table {
256 border: 3px solid #527bbd;
258 thead {
259 font-family: sans-serif;
260 font-weight: bold;
262 tfoot {
263 font-weight: bold;
265 td > div.verse {
266 white-space: pre;
268 p.table {
269 margin-top: 0;
271 /* Because the table frame attribute is overriden by CSS in most browsers. */
272 div.tableblock > table[frame="void"] {
273 border-style: none;
275 div.tableblock > table[frame="hsides"] {
276 border-left-style: none;
277 border-right-style: none;
279 div.tableblock > table[frame="vsides"] {
280 border-top-style: none;
281 border-bottom-style: none;
285 div.hdlist {
286 margin-top: 0.8em;
287 margin-bottom: 0.8em;
289 div.hdlist tr {
290 padding-bottom: 15px;
292 dt.hdlist1.strong, td.hdlist1.strong {
293 font-weight: bold;
295 td.hdlist1 {
296 vertical-align: top;
297 font-style: normal;
298 padding-right: 0.8em;
299 color: navy;
301 td.hdlist2 {
302 vertical-align: top;
304 div.hdlist.compact tr {
305 margin: 0;
306 padding-bottom: 0;
309 .comment {
310 background: yellow;
313 @media print {
314 div#footer-badges { display: none; }
317 div#toctitle {
318 color: #527bbd;
319 font-family: sans-serif;
320 font-size: 1.1em;
321 font-weight: bold;
322 margin-top: 1.0em;
323 margin-bottom: 0.1em;
326 div.toclevel1, div.toclevel2, div.toclevel3, div.toclevel4 {
327 margin-top: 0;
328 margin-bottom: 0;
330 div.toclevel2 {
331 margin-left: 2em;
332 font-size: 0.9em;
334 div.toclevel3 {
335 margin-left: 4em;
336 font-size: 0.9em;
338 div.toclevel4 {
339 margin-left: 6em;
340 font-size: 0.9em;
342 /* Overrides for manpage documents */
343 h1 {
344 padding-top: 0.5em;
345 padding-bottom: 0.5em;
346 border-top: 2px solid silver;
347 border-bottom: 2px solid silver;
349 h2 {
350 border-style: none;
352 div.sectionbody {
353 margin-left: 5%;
356 @media print {
357 div#toc { display: none; }
360 /* Workarounds for IE6's broken and incomplete CSS2. */
362 div.sidebar-content {
363 background: #ffffee;
364 border: 1px solid silver;
365 padding: 0.5em;
367 div.sidebar-title, div.image-title {
368 color: #527bbd;
369 font-family: sans-serif;
370 font-weight: bold;
371 margin-top: 0.0em;
372 margin-bottom: 0.5em;
375 div.listingblock div.content {
376 border: 1px solid silver;
377 background: #f4f4f4;
378 padding: 0.5em;
381 div.quoteblock-attribution {
382 padding-top: 0.5em;
383 text-align: right;
386 div.verseblock-content {
387 white-space: pre;
389 div.verseblock-attribution {
390 padding-top: 0.75em;
391 text-align: left;
394 div.exampleblock-content {
395 border-left: 2px solid silver;
396 padding-left: 0.5em;
399 /* IE6 sets dynamically generated links as visited. */
400 div#toc a:visited { color: blue; }
401 </style>
402 </head>
403 <body>
404 <div id="header">
405 <h1>
406 git-fast-import(1) Manual Page
407 </h1>
408 <h2>NAME</h2>
409 <div class="sectionbody">
410 <p>git-fast-import -
411 Backend for fast Git data importers
412 </p>
413 </div>
414 </div>
415 <h2 id="_synopsis">SYNOPSIS</h2>
416 <div class="sectionbody">
417 <div class="paragraph"><p>frontend | <em>git fast-import</em> [options]</p></div>
418 </div>
419 <h2 id="_description">DESCRIPTION</h2>
420 <div class="sectionbody">
421 <div class="paragraph"><p>This program is usually not what the end user wants to run directly.
422 Most end users want to use one of the existing frontend programs,
423 which parses a specific type of foreign source and feeds the contents
424 stored there to <em>git fast-import</em>.</p></div>
425 <div class="paragraph"><p>fast-import reads a mixed command/data stream from standard input and
426 writes one or more packfiles directly into the current repository.
427 When EOF is received on standard input, fast import writes out
428 updated branch and tag refs, fully updating the current repository
429 with the newly imported data.</p></div>
430 <div class="paragraph"><p>The fast-import backend itself can import into an empty repository (one that
431 has already been initialized by <em>git init</em>) or incrementally
432 update an existing populated repository. Whether or not incremental
433 imports are supported from a particular foreign source depends on
434 the frontend program in use.</p></div>
435 </div>
436 <h2 id="_options">OPTIONS</h2>
437 <div class="sectionbody">
438 <div class="dlist"><dl>
439 <dt class="hdlist1">
440 --date-format=&lt;fmt&gt;
441 </dt>
442 <dd>
444 Specify the type of dates the frontend will supply to
445 fast-import within <tt>author</tt>, <tt>committer</tt> and <tt>tagger</tt> commands.
446 See &#8220;Date Formats&#8221; below for details about which formats
447 are supported, and their syntax.
448 </p>
449 </dd>
450 <dt class="hdlist1">
451 --force
452 </dt>
453 <dd>
455 Force updating modified existing branches, even if doing
456 so would cause commits to be lost (as the new commit does
457 not contain the old commit).
458 </p>
459 </dd>
460 <dt class="hdlist1">
461 --max-pack-size=&lt;n&gt;
462 </dt>
463 <dd>
465 Maximum size of each output packfile.
466 The default is unlimited.
467 </p>
468 </dd>
469 <dt class="hdlist1">
470 --big-file-threshold=&lt;n&gt;
471 </dt>
472 <dd>
474 Maximum size of a blob that fast-import will attempt to
475 create a delta for, expressed in bytes. The default is 512m
476 (512 MiB). Some importers may wish to lower this on systems
477 with constrained memory.
478 </p>
479 </dd>
480 <dt class="hdlist1">
481 --depth=&lt;n&gt;
482 </dt>
483 <dd>
485 Maximum delta depth, for blob and tree deltification.
486 Default is 10.
487 </p>
488 </dd>
489 <dt class="hdlist1">
490 --active-branches=&lt;n&gt;
491 </dt>
492 <dd>
494 Maximum number of branches to maintain active at once.
495 See &#8220;Memory Utilization&#8221; below for details. Default is 5.
496 </p>
497 </dd>
498 <dt class="hdlist1">
499 --export-marks=&lt;file&gt;
500 </dt>
501 <dd>
503 Dumps the internal marks table to &lt;file&gt; when complete.
504 Marks are written one per line as <tt>:markid SHA-1</tt>.
505 Frontends can use this file to validate imports after they
506 have been completed, or to save the marks table across
507 incremental runs. As &lt;file&gt; is only opened and truncated
508 at checkpoint (or completion) the same path can also be
509 safely given to --import-marks.
510 </p>
511 </dd>
512 <dt class="hdlist1">
513 --import-marks=&lt;file&gt;
514 </dt>
515 <dd>
517 Before processing any input, load the marks specified in
518 &lt;file&gt;. The input file must exist, must be readable, and
519 must use the same format as produced by --export-marks.
520 Multiple options may be supplied to import more than one
521 set of marks. If a mark is defined to different values,
522 the last file wins.
523 </p>
524 </dd>
525 <dt class="hdlist1">
526 --import-marks-if-exists=&lt;file&gt;
527 </dt>
528 <dd>
530 Like --import-marks but instead of erroring out, silently
531 skips the file if it does not exist.
532 </p>
533 </dd>
534 <dt class="hdlist1">
535 --relative-marks
536 </dt>
537 <dd>
539 After specifying --relative-marks= the paths specified
540 with --import-marks= and --export-marks= are relative
541 to an internal directory in the current repository.
542 In git-fast-import this means that the paths are relative
543 to the .git/info/fast-import directory. However, other
544 importers may use a different location.
545 </p>
546 </dd>
547 <dt class="hdlist1">
548 --no-relative-marks
549 </dt>
550 <dd>
552 Negates a previous --relative-marks. Allows for combining
553 relative and non-relative marks by interweaving
554 --(no-)-relative-marks= with the --(import|export)-marks=
555 options.
556 </p>
557 </dd>
558 <dt class="hdlist1">
559 --cat-blob-fd=&lt;fd&gt;
560 </dt>
561 <dd>
563 Specify the file descriptor that will be written to
564 when the <tt>cat-blob</tt> command is encountered in the stream.
565 The default behaviour is to write to <tt>stdout</tt>.
566 </p>
567 </dd>
568 <dt class="hdlist1">
569 --export-pack-edges=&lt;file&gt;
570 </dt>
571 <dd>
573 After creating a packfile, print a line of data to
574 &lt;file&gt; listing the filename of the packfile and the last
575 commit on each branch that was written to that packfile.
576 This information may be useful after importing projects
577 whose total object set exceeds the 4 GiB packfile limit,
578 as these commits can be used as edge points during calls
579 to <em>git pack-objects</em>.
580 </p>
581 </dd>
582 <dt class="hdlist1">
583 --quiet
584 </dt>
585 <dd>
587 Disable all non-fatal output, making fast-import silent when it
588 is successful. This option disables the output shown by
589 --stats.
590 </p>
591 </dd>
592 <dt class="hdlist1">
593 --stats
594 </dt>
595 <dd>
597 Display some basic statistics about the objects fast-import has
598 created, the packfiles they were stored into, and the
599 memory used by fast-import during this run. Showing this output
600 is currently the default, but can be disabled with --quiet.
601 </p>
602 </dd>
603 </dl></div>
604 </div>
605 <h2 id="_performance">Performance</h2>
606 <div class="sectionbody">
607 <div class="paragraph"><p>The design of fast-import allows it to import large projects in a minimum
608 amount of memory usage and processing time. Assuming the frontend
609 is able to keep up with fast-import and feed it a constant stream of data,
610 import times for projects holding 10+ years of history and containing
611 100,000+ individual commits are generally completed in just 1-2
612 hours on quite modest (~$2,000 USD) hardware.</p></div>
613 <div class="paragraph"><p>Most bottlenecks appear to be in foreign source data access (the
614 source just cannot extract revisions fast enough) or disk IO (fast-import
615 writes as fast as the disk will take the data). Imports will run
616 faster if the source data is stored on a different drive than the
617 destination Git repository (due to less IO contention).</p></div>
618 </div>
619 <h2 id="_development_cost">Development Cost</h2>
620 <div class="sectionbody">
621 <div class="paragraph"><p>A typical frontend for fast-import tends to weigh in at approximately 200
622 lines of Perl/Python/Ruby code. Most developers have been able to
623 create working importers in just a couple of hours, even though it
624 is their first exposure to fast-import, and sometimes even to Git. This is
625 an ideal situation, given that most conversion tools are throw-away
626 (use once, and never look back).</p></div>
627 </div>
628 <h2 id="_parallel_operation">Parallel Operation</h2>
629 <div class="sectionbody">
630 <div class="paragraph"><p>Like <em>git push</em> or <em>git fetch</em>, imports handled by fast-import are safe to
631 run alongside parallel <tt>git repack -a -d</tt> or <tt>git gc</tt> invocations,
632 or any other Git operation (including <em>git prune</em>, as loose objects
633 are never used by fast-import).</p></div>
634 <div class="paragraph"><p>fast-import does not lock the branch or tag refs it is actively importing.
635 After the import, during its ref update phase, fast-import tests each
636 existing branch ref to verify the update will be a fast-forward
637 update (the commit stored in the ref is contained in the new
638 history of the commit to be written). If the update is not a
639 fast-forward update, fast-import will skip updating that ref and instead
640 prints a warning message. fast-import will always attempt to update all
641 branch refs, and does not stop on the first failure.</p></div>
642 <div class="paragraph"><p>Branch updates can be forced with --force, but it&#8217;s recommended that
643 this only be used on an otherwise quiet repository. Using --force
644 is not necessary for an initial import into an empty repository.</p></div>
645 </div>
646 <h2 id="_technical_discussion">Technical Discussion</h2>
647 <div class="sectionbody">
648 <div class="paragraph"><p>fast-import tracks a set of branches in memory. Any branch can be created
649 or modified at any point during the import process by sending a
650 <tt>commit</tt> command on the input stream. This design allows a frontend
651 program to process an unlimited number of branches simultaneously,
652 generating commits in the order they are available from the source
653 data. It also simplifies the frontend programs considerably.</p></div>
654 <div class="paragraph"><p>fast-import does not use or alter the current working directory, or any
655 file within it. (It does however update the current Git repository,
656 as referenced by <tt>GIT_DIR</tt>.) Therefore an import frontend may use
657 the working directory for its own purposes, such as extracting file
658 revisions from the foreign source. This ignorance of the working
659 directory also allows fast-import to run very quickly, as it does not
660 need to perform any costly file update operations when switching
661 between branches.</p></div>
662 </div>
663 <h2 id="_input_format">Input Format</h2>
664 <div class="sectionbody">
665 <div class="paragraph"><p>With the exception of raw file data (which Git does not interpret)
666 the fast-import input format is text (ASCII) based. This text based
667 format simplifies development and debugging of frontend programs,
668 especially when a higher level language such as Perl, Python or
669 Ruby is being used.</p></div>
670 <div class="paragraph"><p>fast-import is very strict about its input. Where we say SP below we mean
671 <strong>exactly</strong> one space. Likewise LF means one (and only one) linefeed.
672 Supplying additional whitespace characters will cause unexpected
673 results, such as branch names or file names with leading or trailing
674 spaces in their name, or early termination of fast-import when it encounters
675 unexpected input.</p></div>
676 <h3 id="_stream_comments">Stream Comments</h3><div style="clear:left"></div>
677 <div class="paragraph"><p>To aid in debugging frontends fast-import ignores any line that
678 begins with <tt>#</tt> (ASCII pound/hash) up to and including the line
679 ending <tt>LF</tt>. A comment line may contain any sequence of bytes
680 that does not contain an LF and therefore may be used to include
681 any detailed debugging information that might be specific to the
682 frontend and useful when inspecting a fast-import data stream.</p></div>
683 <h3 id="_date_formats">Date Formats</h3><div style="clear:left"></div>
684 <div class="paragraph"><p>The following date formats are supported. A frontend should select
685 the format it will use for this import by passing the format name
686 in the --date-format=&lt;fmt&gt; command line option.</p></div>
687 <div class="dlist"><dl>
688 <dt class="hdlist1">
689 <tt>raw</tt>
690 </dt>
691 <dd>
693 This is the Git native format and is <tt>&lt;time&gt; SP &lt;offutc&gt;</tt>.
694 It is also fast-import&#8217;s default format, if --date-format was
695 not specified.
696 </p>
697 <div class="paragraph"><p>The time of the event is specified by <tt>&lt;time&gt;</tt> as the number of
698 seconds since the UNIX epoch (midnight, Jan 1, 1970, UTC) and is
699 written as an ASCII decimal integer.</p></div>
700 <div class="paragraph"><p>The local offset is specified by <tt>&lt;offutc&gt;</tt> as a positive or negative
701 offset from UTC. For example EST (which is 5 hours behind UTC)
702 would be expressed in <tt>&lt;tz&gt;</tt> by &#8220;-0500&#8221; while UTC is &#8220;+0000&#8221;.
703 The local offset does not affect <tt>&lt;time&gt;</tt>; it is used only as an
704 advisement to help formatting routines display the timestamp.</p></div>
705 <div class="paragraph"><p>If the local offset is not available in the source material, use
706 &#8220;+0000&#8221;, or the most common local offset. For example many
707 organizations have a CVS repository which has only ever been accessed
708 by users who are located in the same location and timezone. In this
709 case a reasonable offset from UTC could be assumed.</p></div>
710 <div class="paragraph"><p>Unlike the <tt>rfc2822</tt> format, this format is very strict. Any
711 variation in formatting will cause fast-import to reject the value.</p></div>
712 </dd>
713 <dt class="hdlist1">
714 <tt>rfc2822</tt>
715 </dt>
716 <dd>
718 This is the standard email format as described by RFC 2822.
719 </p>
720 <div class="paragraph"><p>An example value is &#8220;Tue Feb 6 11:22:18 2007 -0500&#8221;. The Git
721 parser is accurate, but a little on the lenient side. It is the
722 same parser used by <em>git am</em> when applying patches
723 received from email.</p></div>
724 <div class="paragraph"><p>Some malformed strings may be accepted as valid dates. In some of
725 these cases Git will still be able to obtain the correct date from
726 the malformed string. There are also some types of malformed
727 strings which Git will parse wrong, and yet consider valid.
728 Seriously malformed strings will be rejected.</p></div>
729 <div class="paragraph"><p>Unlike the <tt>raw</tt> format above, the timezone/UTC offset information
730 contained in an RFC 2822 date string is used to adjust the date
731 value to UTC prior to storage. Therefore it is important that
732 this information be as accurate as possible.</p></div>
733 <div class="paragraph"><p>If the source material uses RFC 2822 style dates,
734 the frontend should let fast-import handle the parsing and conversion
735 (rather than attempting to do it itself) as the Git parser has
736 been well tested in the wild.</p></div>
737 <div class="paragraph"><p>Frontends should prefer the <tt>raw</tt> format if the source material
738 already uses UNIX-epoch format, can be coaxed to give dates in that
739 format, or its format is easily convertible to it, as there is no
740 ambiguity in parsing.</p></div>
741 </dd>
742 <dt class="hdlist1">
743 <tt>now</tt>
744 </dt>
745 <dd>
747 Always use the current time and timezone. The literal
748 <tt>now</tt> must always be supplied for <tt>&lt;when&gt;</tt>.
749 </p>
750 <div class="paragraph"><p>This is a toy format. The current time and timezone of this system
751 is always copied into the identity string at the time it is being
752 created by fast-import. There is no way to specify a different time or
753 timezone.</p></div>
754 <div class="paragraph"><p>This particular format is supplied as it&#8217;s short to implement and
755 may be useful to a process that wants to create a new commit
756 right now, without needing to use a working directory or
757 <em>git update-index</em>.</p></div>
758 <div class="paragraph"><p>If separate <tt>author</tt> and <tt>committer</tt> commands are used in a <tt>commit</tt>
759 the timestamps may not match, as the system clock will be polled
760 twice (once for each command). The only way to ensure that both
761 author and committer identity information has the same timestamp
762 is to omit <tt>author</tt> (thus copying from <tt>committer</tt>) or to use a
763 date format other than <tt>now</tt>.</p></div>
764 </dd>
765 </dl></div>
766 <h3 id="_commands">Commands</h3><div style="clear:left"></div>
767 <div class="paragraph"><p>fast-import accepts several commands to update the current repository
768 and control the current import process. More detailed discussion
769 (with examples) of each command follows later.</p></div>
770 <div class="dlist"><dl>
771 <dt class="hdlist1">
772 <tt>commit</tt>
773 </dt>
774 <dd>
776 Creates a new branch or updates an existing branch by
777 creating a new commit and updating the branch to point at
778 the newly created commit.
779 </p>
780 </dd>
781 <dt class="hdlist1">
782 <tt>tag</tt>
783 </dt>
784 <dd>
786 Creates an annotated tag object from an existing commit or
787 branch. Lightweight tags are not supported by this command,
788 as they are not recommended for recording meaningful points
789 in time.
790 </p>
791 </dd>
792 <dt class="hdlist1">
793 <tt>reset</tt>
794 </dt>
795 <dd>
797 Reset an existing branch (or a new branch) to a specific
798 revision. This command must be used to change a branch to
799 a specific revision without making a commit on it.
800 </p>
801 </dd>
802 <dt class="hdlist1">
803 <tt>blob</tt>
804 </dt>
805 <dd>
807 Convert raw file data into a blob, for future use in a
808 <tt>commit</tt> command. This command is optional and is not
809 needed to perform an import.
810 </p>
811 </dd>
812 <dt class="hdlist1">
813 <tt>checkpoint</tt>
814 </dt>
815 <dd>
817 Forces fast-import to close the current packfile, generate its
818 unique SHA-1 checksum and index, and start a new packfile.
819 This command is optional and is not needed to perform
820 an import.
821 </p>
822 </dd>
823 <dt class="hdlist1">
824 <tt>progress</tt>
825 </dt>
826 <dd>
828 Causes fast-import to echo the entire line to its own
829 standard output. This command is optional and is not needed
830 to perform an import.
831 </p>
832 </dd>
833 <dt class="hdlist1">
834 <tt>cat-blob</tt>
835 </dt>
836 <dd>
838 Causes fast-import to print a blob in <em>cat-file --batch</em>
839 format to the file descriptor set with <tt>--cat-blob-fd</tt> or
840 <tt>stdout</tt> if unspecified.
841 </p>
842 </dd>
843 <dt class="hdlist1">
844 <tt>feature</tt>
845 </dt>
846 <dd>
848 Require that fast-import supports the specified feature, or
849 abort if it does not.
850 </p>
851 </dd>
852 <dt class="hdlist1">
853 <tt>option</tt>
854 </dt>
855 <dd>
857 Specify any of the options listed under OPTIONS that do not
858 change stream semantic to suit the frontend&#8217;s needs. This
859 command is optional and is not needed to perform an import.
860 </p>
861 </dd>
862 </dl></div>
863 <h3 id="_tt_commit_tt"><tt>commit</tt></h3><div style="clear:left"></div>
864 <div class="paragraph"><p>Create or update a branch with a new commit, recording one logical
865 change to the project.</p></div>
866 <div class="literalblock">
867 <div class="content">
868 <pre><tt> 'commit' SP &lt;ref&gt; LF
869 mark?
870 ('author' (SP &lt;name&gt;)? SP LT &lt;email&gt; GT SP &lt;when&gt; LF)?
871 'committer' (SP &lt;name&gt;)? SP LT &lt;email&gt; GT SP &lt;when&gt; LF
872 data
873 ('from' SP &lt;committish&gt; LF)?
874 ('merge' SP &lt;committish&gt; LF)?
875 (filemodify | filedelete | filecopy | filerename | filedeleteall | notemodify)*
876 LF?</tt></pre>
877 </div></div>
878 <div class="paragraph"><p>where <tt>&lt;ref&gt;</tt> is the name of the branch to make the commit on.
879 Typically branch names are prefixed with <tt>refs/heads/</tt> in
880 Git, so importing the CVS branch symbol <tt>RELENG-1_0</tt> would use
881 <tt>refs/heads/RELENG-1_0</tt> for the value of <tt>&lt;ref&gt;</tt>. The value of
882 <tt>&lt;ref&gt;</tt> must be a valid refname in Git. As <tt>LF</tt> is not valid in
883 a Git refname, no quoting or escaping syntax is supported here.</p></div>
884 <div class="paragraph"><p>A <tt>mark</tt> command may optionally appear, requesting fast-import to save a
885 reference to the newly created commit for future use by the frontend
886 (see below for format). It is very common for frontends to mark
887 every commit they create, thereby allowing future branch creation
888 from any imported commit.</p></div>
889 <div class="paragraph"><p>The <tt>data</tt> command following <tt>committer</tt> must supply the commit
890 message (see below for <tt>data</tt> command syntax). To import an empty
891 commit message use a 0 length data. Commit messages are free-form
892 and are not interpreted by Git. Currently they must be encoded in
893 UTF-8, as fast-import does not permit other encodings to be specified.</p></div>
894 <div class="paragraph"><p>Zero or more <tt>filemodify</tt>, <tt>filedelete</tt>, <tt>filecopy</tt>, <tt>filerename</tt>,
895 <tt>filedeleteall</tt> and <tt>notemodify</tt> commands
896 may be included to update the contents of the branch prior to
897 creating the commit. These commands may be supplied in any order.
898 However it is recommended that a <tt>filedeleteall</tt> command precede
899 all <tt>filemodify</tt>, <tt>filecopy</tt>, <tt>filerename</tt> and <tt>notemodify</tt> commands in
900 the same commit, as <tt>filedeleteall</tt> wipes the branch clean (see below).</p></div>
901 <div class="paragraph"><p>The <tt>LF</tt> after the command is optional (it used to be required).</p></div>
902 <h4 id="_tt_author_tt"><tt>author</tt></h4>
903 <div class="paragraph"><p>An <tt>author</tt> command may optionally appear, if the author information
904 might differ from the committer information. If <tt>author</tt> is omitted
905 then fast-import will automatically use the committer&#8217;s information for
906 the author portion of the commit. See below for a description of
907 the fields in <tt>author</tt>, as they are identical to <tt>committer</tt>.</p></div>
908 <h4 id="_tt_committer_tt"><tt>committer</tt></h4>
909 <div class="paragraph"><p>The <tt>committer</tt> command indicates who made this commit, and when
910 they made it.</p></div>
911 <div class="paragraph"><p>Here <tt>&lt;name&gt;</tt> is the person&#8217;s display name (for example
912 &#8220;Com M Itter&#8221;) and <tt>&lt;email&gt;</tt> is the person&#8217;s email address
913 (&#8220;<a href="mailto:cm@example.com">cm@example.com</a>&#8221;). <tt>LT</tt> and <tt>GT</tt> are the literal less-than (\x3c)
914 and greater-than (\x3e) symbols. These are required to delimit
915 the email address from the other fields in the line. Note that
916 <tt>&lt;name&gt;</tt> is free-form and may contain any sequence of bytes, except
917 <tt>LT</tt> and <tt>LF</tt>. It is typically UTF-8 encoded.</p></div>
918 <div class="paragraph"><p>The time of the change is specified by <tt>&lt;when&gt;</tt> using the date format
919 that was selected by the --date-format=&lt;fmt&gt; command line option.
920 See &#8220;Date Formats&#8221; above for the set of supported formats, and
921 their syntax.</p></div>
922 <h4 id="_tt_from_tt"><tt>from</tt></h4>
923 <div class="paragraph"><p>The <tt>from</tt> command is used to specify the commit to initialize
924 this branch from. This revision will be the first ancestor of the
925 new commit.</p></div>
926 <div class="paragraph"><p>Omitting the <tt>from</tt> command in the first commit of a new branch
927 will cause fast-import to create that commit with no ancestor. This
928 tends to be desired only for the initial commit of a project.
929 If the frontend creates all files from scratch when making a new
930 branch, a <tt>merge</tt> command may be used instead of <tt>from</tt> to start
931 the commit with an empty tree.
932 Omitting the <tt>from</tt> command on existing branches is usually desired,
933 as the current commit on that branch is automatically assumed to
934 be the first ancestor of the new commit.</p></div>
935 <div class="paragraph"><p>As <tt>LF</tt> is not valid in a Git refname or SHA-1 expression, no
936 quoting or escaping syntax is supported within <tt>&lt;committish&gt;</tt>.</p></div>
937 <div class="paragraph"><p>Here <tt>&lt;committish&gt;</tt> is any of the following:</p></div>
938 <div class="ulist"><ul>
939 <li>
941 The name of an existing branch already in fast-import&#8217;s internal branch
942 table. If fast-import doesn&#8217;t know the name, it&#8217;s treated as a SHA-1
943 expression.
944 </p>
945 </li>
946 <li>
948 A mark reference, <tt>:&lt;idnum&gt;</tt>, where <tt>&lt;idnum&gt;</tt> is the mark number.
949 </p>
950 <div class="paragraph"><p>The reason fast-import uses <tt>:</tt> to denote a mark reference is this character
951 is not legal in a Git branch name. The leading <tt>:</tt> makes it easy
952 to distinguish between the mark 42 (<tt>:42</tt>) and the branch 42 (<tt>42</tt>
953 or <tt>refs/heads/42</tt>), or an abbreviated SHA-1 which happened to
954 consist only of base-10 digits.</p></div>
955 <div class="paragraph"><p>Marks must be declared (via <tt>mark</tt>) before they can be used.</p></div>
956 </li>
957 <li>
959 A complete 40 byte or abbreviated commit SHA-1 in hex.
960 </p>
961 </li>
962 <li>
964 Any valid Git SHA-1 expression that resolves to a commit. See
965 &#8220;SPECIFYING REVISIONS&#8221; in <a href="gitrevisions.html">gitrevisions(7)</a> for details.
966 </p>
967 </li>
968 </ul></div>
969 <div class="paragraph"><p>The special case of restarting an incremental import from the
970 current branch value should be written as:</p></div>
971 <div class="listingblock">
972 <div class="content">
973 <pre><tt> from refs/heads/branch^0</tt></pre>
974 </div></div>
975 <div class="paragraph"><p>The <tt>&#94;0</tt> suffix is necessary as fast-import does not permit a branch to
976 start from itself, and the branch is created in memory before the
977 <tt>from</tt> command is even read from the input. Adding <tt>&#94;0</tt> will force
978 fast-import to resolve the commit through Git&#8217;s revision parsing library,
979 rather than its internal branch table, thereby loading in the
980 existing value of the branch.</p></div>
981 <h4 id="_tt_merge_tt"><tt>merge</tt></h4>
982 <div class="paragraph"><p>Includes one additional ancestor commit. If the <tt>from</tt> command is
983 omitted when creating a new branch, the first <tt>merge</tt> commit will be
984 the first ancestor of the current commit, and the branch will start
985 out with no files. An unlimited number of <tt>merge</tt> commands per
986 commit are permitted by fast-import, thereby establishing an n-way merge.
987 However Git&#8217;s other tools never create commits with more than 15
988 additional ancestors (forming a 16-way merge). For this reason
989 it is suggested that frontends do not use more than 15 <tt>merge</tt>
990 commands per commit; 16, if starting a new, empty branch.</p></div>
991 <div class="paragraph"><p>Here <tt>&lt;committish&gt;</tt> is any of the commit specification expressions
992 also accepted by <tt>from</tt> (see above).</p></div>
993 <h4 id="_tt_filemodify_tt"><tt>filemodify</tt></h4>
994 <div class="paragraph"><p>Included in a <tt>commit</tt> command to add a new file or change the
995 content of an existing file. This command has two different means
996 of specifying the content of the file.</p></div>
997 <div class="dlist"><dl>
998 <dt class="hdlist1">
999 External data format
1000 </dt>
1001 <dd>
1003 The data content for the file was already supplied by a prior
1004 <tt>blob</tt> command. The frontend just needs to connect it.
1005 </p>
1006 <div class="literalblock">
1007 <div class="content">
1008 <pre><tt> 'M' SP &lt;mode&gt; SP &lt;dataref&gt; SP &lt;path&gt; LF</tt></pre>
1009 </div></div>
1010 <div class="paragraph"><p>Here usually <tt>&lt;dataref&gt;</tt> must be either a mark reference (<tt>:&lt;idnum&gt;</tt>)
1011 set by a prior <tt>blob</tt> command, or a full 40-byte SHA-1 of an
1012 existing Git blob object. If <tt>&lt;mode&gt;</tt> is <tt>040000</tt>` then
1013 <tt>&lt;dataref&gt;</tt> must be the full 40-byte SHA-1 of an existing
1014 Git tree object or a mark reference set with <tt>--import-marks</tt>.</p></div>
1015 </dd>
1016 <dt class="hdlist1">
1017 Inline data format
1018 </dt>
1019 <dd>
1021 The data content for the file has not been supplied yet.
1022 The frontend wants to supply it as part of this modify
1023 command.
1024 </p>
1025 <div class="literalblock">
1026 <div class="content">
1027 <pre><tt> 'M' SP &lt;mode&gt; SP 'inline' SP &lt;path&gt; LF
1028 data</tt></pre>
1029 </div></div>
1030 <div class="paragraph"><p>See below for a detailed description of the <tt>data</tt> command.</p></div>
1031 </dd>
1032 </dl></div>
1033 <div class="paragraph"><p>In both formats <tt>&lt;mode&gt;</tt> is the type of file entry, specified
1034 in octal. Git only supports the following modes:</p></div>
1035 <div class="ulist"><ul>
1036 <li>
1038 <tt>100644</tt> or <tt>644</tt>: A normal (not-executable) file. The majority
1039 of files in most projects use this mode. If in doubt, this is
1040 what you want.
1041 </p>
1042 </li>
1043 <li>
1045 <tt>100755</tt> or <tt>755</tt>: A normal, but executable, file.
1046 </p>
1047 </li>
1048 <li>
1050 <tt>120000</tt>: A symlink, the content of the file will be the link target.
1051 </p>
1052 </li>
1053 <li>
1055 <tt>160000</tt>: A gitlink, SHA-1 of the object refers to a commit in
1056 another repository. Git links can only be specified by SHA or through
1057 a commit mark. They are used to implement submodules.
1058 </p>
1059 </li>
1060 <li>
1062 <tt>040000</tt>: A subdirectory. Subdirectories can only be specified by
1063 SHA or through a tree mark set with <tt>--import-marks</tt>.
1064 </p>
1065 </li>
1066 </ul></div>
1067 <div class="paragraph"><p>In both formats <tt>&lt;path&gt;</tt> is the complete path of the file to be added
1068 (if not already existing) or modified (if already existing).</p></div>
1069 <div class="paragraph"><p>A <tt>&lt;path&gt;</tt> string must use UNIX-style directory separators (forward
1070 slash <tt>/</tt>), may contain any byte other than <tt>LF</tt>, and must not
1071 start with double quote (<tt>"</tt>).</p></div>
1072 <div class="paragraph"><p>If an <tt>LF</tt> or double quote must be encoded into <tt>&lt;path&gt;</tt> shell-style
1073 quoting should be used, e.g. <tt>"path/with\n and \" in it"</tt>.</p></div>
1074 <div class="paragraph"><p>The value of <tt>&lt;path&gt;</tt> must be in canonical form. That is it must not:</p></div>
1075 <div class="ulist"><ul>
1076 <li>
1078 contain an empty directory component (e.g. <tt>foo//bar</tt> is invalid),
1079 </p>
1080 </li>
1081 <li>
1083 end with a directory separator (e.g. <tt>foo/</tt> is invalid),
1084 </p>
1085 </li>
1086 <li>
1088 start with a directory separator (e.g. <tt>/foo</tt> is invalid),
1089 </p>
1090 </li>
1091 <li>
1093 contain the special component <tt>.</tt> or <tt>..</tt> (e.g. <tt>foo/./bar</tt> and
1094 <tt>foo/../bar</tt> are invalid).
1095 </p>
1096 </li>
1097 </ul></div>
1098 <div class="paragraph"><p>The root of the tree can be represented by an empty string as <tt>&lt;path&gt;</tt>.</p></div>
1099 <div class="paragraph"><p>It is recommended that <tt>&lt;path&gt;</tt> always be encoded using UTF-8.</p></div>
1100 <h4 id="_tt_filedelete_tt"><tt>filedelete</tt></h4>
1101 <div class="paragraph"><p>Included in a <tt>commit</tt> command to remove a file or recursively
1102 delete an entire directory from the branch. If the file or directory
1103 removal makes its parent directory empty, the parent directory will
1104 be automatically removed too. This cascades up the tree until the
1105 first non-empty directory or the root is reached.</p></div>
1106 <div class="literalblock">
1107 <div class="content">
1108 <pre><tt> 'D' SP &lt;path&gt; LF</tt></pre>
1109 </div></div>
1110 <div class="paragraph"><p>here <tt>&lt;path&gt;</tt> is the complete path of the file or subdirectory to
1111 be removed from the branch.
1112 See <tt>filemodify</tt> above for a detailed description of <tt>&lt;path&gt;</tt>.</p></div>
1113 <h4 id="_tt_filecopy_tt"><tt>filecopy</tt></h4>
1114 <div class="paragraph"><p>Recursively copies an existing file or subdirectory to a different
1115 location within the branch. The existing file or directory must
1116 exist. If the destination exists it will be completely replaced
1117 by the content copied from the source.</p></div>
1118 <div class="literalblock">
1119 <div class="content">
1120 <pre><tt> 'C' SP &lt;path&gt; SP &lt;path&gt; LF</tt></pre>
1121 </div></div>
1122 <div class="paragraph"><p>here the first <tt>&lt;path&gt;</tt> is the source location and the second
1123 <tt>&lt;path&gt;</tt> is the destination. See <tt>filemodify</tt> above for a detailed
1124 description of what <tt>&lt;path&gt;</tt> may look like. To use a source path
1125 that contains SP the path must be quoted.</p></div>
1126 <div class="paragraph"><p>A <tt>filecopy</tt> command takes effect immediately. Once the source
1127 location has been copied to the destination any future commands
1128 applied to the source location will not impact the destination of
1129 the copy.</p></div>
1130 <h4 id="_tt_filerename_tt"><tt>filerename</tt></h4>
1131 <div class="paragraph"><p>Renames an existing file or subdirectory to a different location
1132 within the branch. The existing file or directory must exist. If
1133 the destination exists it will be replaced by the source directory.</p></div>
1134 <div class="literalblock">
1135 <div class="content">
1136 <pre><tt> 'R' SP &lt;path&gt; SP &lt;path&gt; LF</tt></pre>
1137 </div></div>
1138 <div class="paragraph"><p>here the first <tt>&lt;path&gt;</tt> is the source location and the second
1139 <tt>&lt;path&gt;</tt> is the destination. See <tt>filemodify</tt> above for a detailed
1140 description of what <tt>&lt;path&gt;</tt> may look like. To use a source path
1141 that contains SP the path must be quoted.</p></div>
1142 <div class="paragraph"><p>A <tt>filerename</tt> command takes effect immediately. Once the source
1143 location has been renamed to the destination any future commands
1144 applied to the source location will create new files there and not
1145 impact the destination of the rename.</p></div>
1146 <div class="paragraph"><p>Note that a <tt>filerename</tt> is the same as a <tt>filecopy</tt> followed by a
1147 <tt>filedelete</tt> of the source location. There is a slight performance
1148 advantage to using <tt>filerename</tt>, but the advantage is so small
1149 that it is never worth trying to convert a delete/add pair in
1150 source material into a rename for fast-import. This <tt>filerename</tt>
1151 command is provided just to simplify frontends that already have
1152 rename information and don&#8217;t want bother with decomposing it into a
1153 <tt>filecopy</tt> followed by a <tt>filedelete</tt>.</p></div>
1154 <h4 id="_tt_filedeleteall_tt"><tt>filedeleteall</tt></h4>
1155 <div class="paragraph"><p>Included in a <tt>commit</tt> command to remove all files (and also all
1156 directories) from the branch. This command resets the internal
1157 branch structure to have no files in it, allowing the frontend
1158 to subsequently add all interesting files from scratch.</p></div>
1159 <div class="literalblock">
1160 <div class="content">
1161 <pre><tt> 'deleteall' LF</tt></pre>
1162 </div></div>
1163 <div class="paragraph"><p>This command is extremely useful if the frontend does not know
1164 (or does not care to know) what files are currently on the branch,
1165 and therefore cannot generate the proper <tt>filedelete</tt> commands to
1166 update the content.</p></div>
1167 <div class="paragraph"><p>Issuing a <tt>filedeleteall</tt> followed by the needed <tt>filemodify</tt>
1168 commands to set the correct content will produce the same results
1169 as sending only the needed <tt>filemodify</tt> and <tt>filedelete</tt> commands.
1170 The <tt>filedeleteall</tt> approach may however require fast-import to use slightly
1171 more memory per active branch (less than 1 MiB for even most large
1172 projects); so frontends that can easily obtain only the affected
1173 paths for a commit are encouraged to do so.</p></div>
1174 <h4 id="_tt_notemodify_tt"><tt>notemodify</tt></h4>
1175 <div class="paragraph"><p>Included in a <tt>commit</tt> command to add a new note (annotating a given
1176 commit) or change the content of an existing note. This command has
1177 two different means of specifying the content of the note.</p></div>
1178 <div class="dlist"><dl>
1179 <dt class="hdlist1">
1180 External data format
1181 </dt>
1182 <dd>
1184 The data content for the note was already supplied by a prior
1185 <tt>blob</tt> command. The frontend just needs to connect it to the
1186 commit that is to be annotated.
1187 </p>
1188 <div class="literalblock">
1189 <div class="content">
1190 <pre><tt> 'N' SP &lt;dataref&gt; SP &lt;committish&gt; LF</tt></pre>
1191 </div></div>
1192 <div class="paragraph"><p>Here <tt>&lt;dataref&gt;</tt> can be either a mark reference (<tt>:&lt;idnum&gt;</tt>)
1193 set by a prior <tt>blob</tt> command, or a full 40-byte SHA-1 of an
1194 existing Git blob object.</p></div>
1195 </dd>
1196 <dt class="hdlist1">
1197 Inline data format
1198 </dt>
1199 <dd>
1201 The data content for the note has not been supplied yet.
1202 The frontend wants to supply it as part of this modify
1203 command.
1204 </p>
1205 <div class="literalblock">
1206 <div class="content">
1207 <pre><tt> 'N' SP 'inline' SP &lt;committish&gt; LF
1208 data</tt></pre>
1209 </div></div>
1210 <div class="paragraph"><p>See below for a detailed description of the <tt>data</tt> command.</p></div>
1211 </dd>
1212 </dl></div>
1213 <div class="paragraph"><p>In both formats <tt>&lt;committish&gt;</tt> is any of the commit specification
1214 expressions also accepted by <tt>from</tt> (see above).</p></div>
1215 <h3 id="_tt_mark_tt"><tt>mark</tt></h3><div style="clear:left"></div>
1216 <div class="paragraph"><p>Arranges for fast-import to save a reference to the current object, allowing
1217 the frontend to recall this object at a future point in time, without
1218 knowing its SHA-1. Here the current object is the object creation
1219 command the <tt>mark</tt> command appears within. This can be <tt>commit</tt>,
1220 <tt>tag</tt>, and <tt>blob</tt>, but <tt>commit</tt> is the most common usage.</p></div>
1221 <div class="literalblock">
1222 <div class="content">
1223 <pre><tt> 'mark' SP ':' &lt;idnum&gt; LF</tt></pre>
1224 </div></div>
1225 <div class="paragraph"><p>where <tt>&lt;idnum&gt;</tt> is the number assigned by the frontend to this mark.
1226 The value of <tt>&lt;idnum&gt;</tt> is expressed as an ASCII decimal integer.
1227 The value 0 is reserved and cannot be used as
1228 a mark. Only values greater than or equal to 1 may be used as marks.</p></div>
1229 <div class="paragraph"><p>New marks are created automatically. Existing marks can be moved
1230 to another object simply by reusing the same <tt>&lt;idnum&gt;</tt> in another
1231 <tt>mark</tt> command.</p></div>
1232 <h3 id="_tt_tag_tt"><tt>tag</tt></h3><div style="clear:left"></div>
1233 <div class="paragraph"><p>Creates an annotated tag referring to a specific commit. To create
1234 lightweight (non-annotated) tags see the <tt>reset</tt> command below.</p></div>
1235 <div class="literalblock">
1236 <div class="content">
1237 <pre><tt> 'tag' SP &lt;name&gt; LF
1238 'from' SP &lt;committish&gt; LF
1239 'tagger' (SP &lt;name&gt;)? SP LT &lt;email&gt; GT SP &lt;when&gt; LF
1240 data</tt></pre>
1241 </div></div>
1242 <div class="paragraph"><p>where <tt>&lt;name&gt;</tt> is the name of the tag to create.</p></div>
1243 <div class="paragraph"><p>Tag names are automatically prefixed with <tt>refs/tags/</tt> when stored
1244 in Git, so importing the CVS branch symbol <tt>RELENG-1_0-FINAL</tt> would
1245 use just <tt>RELENG-1_0-FINAL</tt> for <tt>&lt;name&gt;</tt>, and fast-import will write the
1246 corresponding ref as <tt>refs/tags/RELENG-1_0-FINAL</tt>.</p></div>
1247 <div class="paragraph"><p>The value of <tt>&lt;name&gt;</tt> must be a valid refname in Git and therefore
1248 may contain forward slashes. As <tt>LF</tt> is not valid in a Git refname,
1249 no quoting or escaping syntax is supported here.</p></div>
1250 <div class="paragraph"><p>The <tt>from</tt> command is the same as in the <tt>commit</tt> command; see
1251 above for details.</p></div>
1252 <div class="paragraph"><p>The <tt>tagger</tt> command uses the same format as <tt>committer</tt> within
1253 <tt>commit</tt>; again see above for details.</p></div>
1254 <div class="paragraph"><p>The <tt>data</tt> command following <tt>tagger</tt> must supply the annotated tag
1255 message (see below for <tt>data</tt> command syntax). To import an empty
1256 tag message use a 0 length data. Tag messages are free-form and are
1257 not interpreted by Git. Currently they must be encoded in UTF-8,
1258 as fast-import does not permit other encodings to be specified.</p></div>
1259 <div class="paragraph"><p>Signing annotated tags during import from within fast-import is not
1260 supported. Trying to include your own PGP/GPG signature is not
1261 recommended, as the frontend does not (easily) have access to the
1262 complete set of bytes which normally goes into such a signature.
1263 If signing is required, create lightweight tags from within fast-import with
1264 <tt>reset</tt>, then create the annotated versions of those tags offline
1265 with the standard <em>git tag</em> process.</p></div>
1266 <h3 id="_tt_reset_tt"><tt>reset</tt></h3><div style="clear:left"></div>
1267 <div class="paragraph"><p>Creates (or recreates) the named branch, optionally starting from
1268 a specific revision. The reset command allows a frontend to issue
1269 a new <tt>from</tt> command for an existing branch, or to create a new
1270 branch from an existing commit without creating a new commit.</p></div>
1271 <div class="literalblock">
1272 <div class="content">
1273 <pre><tt> 'reset' SP &lt;ref&gt; LF
1274 ('from' SP &lt;committish&gt; LF)?
1275 LF?</tt></pre>
1276 </div></div>
1277 <div class="paragraph"><p>For a detailed description of <tt>&lt;ref&gt;</tt> and <tt>&lt;committish&gt;</tt> see above
1278 under <tt>commit</tt> and <tt>from</tt>.</p></div>
1279 <div class="paragraph"><p>The <tt>LF</tt> after the command is optional (it used to be required).</p></div>
1280 <div class="paragraph"><p>The <tt>reset</tt> command can also be used to create lightweight
1281 (non-annotated) tags. For example:</p></div>
1282 <div class="exampleblock">
1283 <div class="exampleblock-content">
1284 <div class="literalblock">
1285 <div class="content">
1286 <pre><tt>reset refs/tags/938
1287 from :938</tt></pre>
1288 </div></div>
1289 </div></div>
1290 <div class="paragraph"><p>would create the lightweight tag <tt>refs/tags/938</tt> referring to
1291 whatever commit mark <tt>:938</tt> references.</p></div>
1292 <h3 id="_tt_blob_tt"><tt>blob</tt></h3><div style="clear:left"></div>
1293 <div class="paragraph"><p>Requests writing one file revision to the packfile. The revision
1294 is not connected to any commit; this connection must be formed in
1295 a subsequent <tt>commit</tt> command by referencing the blob through an
1296 assigned mark.</p></div>
1297 <div class="literalblock">
1298 <div class="content">
1299 <pre><tt> 'blob' LF
1300 mark?
1301 data</tt></pre>
1302 </div></div>
1303 <div class="paragraph"><p>The mark command is optional here as some frontends have chosen
1304 to generate the Git SHA-1 for the blob on their own, and feed that
1305 directly to <tt>commit</tt>. This is typically more work than it&#8217;s worth
1306 however, as marks are inexpensive to store and easy to use.</p></div>
1307 <h3 id="_tt_data_tt"><tt>data</tt></h3><div style="clear:left"></div>
1308 <div class="paragraph"><p>Supplies raw data (for use as blob/file content, commit messages, or
1309 annotated tag messages) to fast-import. Data can be supplied using an exact
1310 byte count or delimited with a terminating line. Real frontends
1311 intended for production-quality conversions should always use the
1312 exact byte count format, as it is more robust and performs better.
1313 The delimited format is intended primarily for testing fast-import.</p></div>
1314 <div class="paragraph"><p>Comment lines appearing within the <tt>&lt;raw&gt;</tt> part of <tt>data</tt> commands
1315 are always taken to be part of the body of the data and are therefore
1316 never ignored by fast-import. This makes it safe to import any
1317 file/message content whose lines might start with <tt>#</tt>.</p></div>
1318 <div class="dlist"><dl>
1319 <dt class="hdlist1">
1320 Exact byte count format
1321 </dt>
1322 <dd>
1324 The frontend must specify the number of bytes of data.
1325 </p>
1326 <div class="literalblock">
1327 <div class="content">
1328 <pre><tt> 'data' SP &lt;count&gt; LF
1329 &lt;raw&gt; LF?</tt></pre>
1330 </div></div>
1331 <div class="paragraph"><p>where <tt>&lt;count&gt;</tt> is the exact number of bytes appearing within
1332 <tt>&lt;raw&gt;</tt>. The value of <tt>&lt;count&gt;</tt> is expressed as an ASCII decimal
1333 integer. The <tt>LF</tt> on either side of <tt>&lt;raw&gt;</tt> is not
1334 included in <tt>&lt;count&gt;</tt> and will not be included in the imported data.</p></div>
1335 <div class="paragraph"><p>The <tt>LF</tt> after <tt>&lt;raw&gt;</tt> is optional (it used to be required) but
1336 recommended. Always including it makes debugging a fast-import
1337 stream easier as the next command always starts in column 0
1338 of the next line, even if <tt>&lt;raw&gt;</tt> did not end with an <tt>LF</tt>.</p></div>
1339 </dd>
1340 <dt class="hdlist1">
1341 Delimited format
1342 </dt>
1343 <dd>
1345 A delimiter string is used to mark the end of the data.
1346 fast-import will compute the length by searching for the delimiter.
1347 This format is primarily useful for testing and is not
1348 recommended for real data.
1349 </p>
1350 <div class="literalblock">
1351 <div class="content">
1352 <pre><tt> 'data' SP '&lt;&lt;' &lt;delim&gt; LF
1353 &lt;raw&gt; LF
1354 &lt;delim&gt; LF
1355 LF?</tt></pre>
1356 </div></div>
1357 <div class="paragraph"><p>where <tt>&lt;delim&gt;</tt> is the chosen delimiter string. The string <tt>&lt;delim&gt;</tt>
1358 must not appear on a line by itself within <tt>&lt;raw&gt;</tt>, as otherwise
1359 fast-import will think the data ends earlier than it really does. The <tt>LF</tt>
1360 immediately trailing <tt>&lt;raw&gt;</tt> is part of <tt>&lt;raw&gt;</tt>. This is one of
1361 the limitations of the delimited format, it is impossible to supply
1362 a data chunk which does not have an LF as its last byte.</p></div>
1363 <div class="paragraph"><p>The <tt>LF</tt> after <tt>&lt;delim&gt; LF</tt> is optional (it used to be required).</p></div>
1364 </dd>
1365 </dl></div>
1366 <h3 id="_tt_checkpoint_tt"><tt>checkpoint</tt></h3><div style="clear:left"></div>
1367 <div class="paragraph"><p>Forces fast-import to close the current packfile, start a new one, and to
1368 save out all current branch refs, tags and marks.</p></div>
1369 <div class="literalblock">
1370 <div class="content">
1371 <pre><tt> 'checkpoint' LF
1372 LF?</tt></pre>
1373 </div></div>
1374 <div class="paragraph"><p>Note that fast-import automatically switches packfiles when the current
1375 packfile reaches --max-pack-size, or 4 GiB, whichever limit is
1376 smaller. During an automatic packfile switch fast-import does not update
1377 the branch refs, tags or marks.</p></div>
1378 <div class="paragraph"><p>As a <tt>checkpoint</tt> can require a significant amount of CPU time and
1379 disk IO (to compute the overall pack SHA-1 checksum, generate the
1380 corresponding index file, and update the refs) it can easily take
1381 several minutes for a single <tt>checkpoint</tt> command to complete.</p></div>
1382 <div class="paragraph"><p>Frontends may choose to issue checkpoints during extremely large
1383 and long running imports, or when they need to allow another Git
1384 process access to a branch. However given that a 30 GiB Subversion
1385 repository can be loaded into Git through fast-import in about 3 hours,
1386 explicit checkpointing may not be necessary.</p></div>
1387 <div class="paragraph"><p>The <tt>LF</tt> after the command is optional (it used to be required).</p></div>
1388 <h3 id="_tt_progress_tt"><tt>progress</tt></h3><div style="clear:left"></div>
1389 <div class="paragraph"><p>Causes fast-import to print the entire <tt>progress</tt> line unmodified to
1390 its standard output channel (file descriptor 1) when the command is
1391 processed from the input stream. The command otherwise has no impact
1392 on the current import, or on any of fast-import&#8217;s internal state.</p></div>
1393 <div class="literalblock">
1394 <div class="content">
1395 <pre><tt> 'progress' SP &lt;any&gt; LF
1396 LF?</tt></pre>
1397 </div></div>
1398 <div class="paragraph"><p>The <tt>&lt;any&gt;</tt> part of the command may contain any sequence of bytes
1399 that does not contain <tt>LF</tt>. The <tt>LF</tt> after the command is optional.
1400 Callers may wish to process the output through a tool such as sed to
1401 remove the leading part of the line, for example:</p></div>
1402 <div class="exampleblock">
1403 <div class="exampleblock-content">
1404 <div class="literalblock">
1405 <div class="content">
1406 <pre><tt>frontend | git fast-import | sed 's/^progress //'</tt></pre>
1407 </div></div>
1408 </div></div>
1409 <div class="paragraph"><p>Placing a <tt>progress</tt> command immediately after a <tt>checkpoint</tt> will
1410 inform the reader when the <tt>checkpoint</tt> has been completed and it
1411 can safely access the refs that fast-import updated.</p></div>
1412 <h3 id="_tt_cat_blob_tt"><tt>cat-blob</tt></h3><div style="clear:left"></div>
1413 <div class="paragraph"><p>Causes fast-import to print a blob to a file descriptor previously
1414 arranged with the <tt>--cat-blob-fd</tt> argument. The command otherwise
1415 has no impact on the current import; its main purpose is to
1416 retrieve blobs that may be in fast-import&#8217;s memory but not
1417 accessible from the target repository.</p></div>
1418 <div class="literalblock">
1419 <div class="content">
1420 <pre><tt> 'cat-blob' SP &lt;dataref&gt; LF</tt></pre>
1421 </div></div>
1422 <div class="paragraph"><p>The <tt>&lt;dataref&gt;</tt> can be either a mark reference (<tt>:&lt;idnum&gt;</tt>)
1423 set previously or a full 40-byte SHA-1 of a Git blob, preexisting or
1424 ready to be written.</p></div>
1425 <div class="paragraph"><p>Output uses the same format as <tt>git cat-file --batch</tt>:</p></div>
1426 <div class="exampleblock">
1427 <div class="exampleblock-content">
1428 <div class="literalblock">
1429 <div class="content">
1430 <pre><tt>&lt;sha1&gt; SP 'blob' SP &lt;size&gt; LF
1431 &lt;contents&gt; LF</tt></pre>
1432 </div></div>
1433 </div></div>
1434 <div class="paragraph"><p>This command can be used anywhere in the stream that comments are
1435 accepted. In particular, the <tt>cat-blob</tt> command can be used in the
1436 middle of a commit but not in the middle of a <tt>data</tt> command.</p></div>
1437 <h3 id="_tt_feature_tt"><tt>feature</tt></h3><div style="clear:left"></div>
1438 <div class="paragraph"><p>Require that fast-import supports the specified feature, or abort if
1439 it does not.</p></div>
1440 <div class="literalblock">
1441 <div class="content">
1442 <pre><tt> 'feature' SP &lt;feature&gt; ('=' &lt;argument&gt;)? LF</tt></pre>
1443 </div></div>
1444 <div class="paragraph"><p>The &lt;feature&gt; part of the command may be any one of the following:</p></div>
1445 <div class="dlist"><dl>
1446 <dt class="hdlist1">
1447 date-format
1448 </dt>
1449 <dt class="hdlist1">
1450 export-marks
1451 </dt>
1452 <dt class="hdlist1">
1453 relative-marks
1454 </dt>
1455 <dt class="hdlist1">
1456 no-relative-marks
1457 </dt>
1458 <dt class="hdlist1">
1459 force
1460 </dt>
1461 <dd>
1463 Act as though the corresponding command-line option with
1464 a leading <em>--</em> was passed on the command line
1465 (see OPTIONS, above).
1466 </p>
1467 </dd>
1468 <dt class="hdlist1">
1469 import-marks
1470 </dt>
1471 <dd>
1473 Like --import-marks except in two respects: first, only one
1474 "feature import-marks" command is allowed per stream;
1475 second, an --import-marks= command-line option overrides
1476 any "feature import-marks" command in the stream.
1477 </p>
1478 </dd>
1479 <dt class="hdlist1">
1480 cat-blob
1481 </dt>
1482 <dd>
1484 Ignored. Versions of fast-import not supporting the
1485 "cat-blob" command will exit with a message indicating so.
1486 This lets the import error out early with a clear message,
1487 rather than wasting time on the early part of an import
1488 before the unsupported command is detected.
1489 </p>
1490 </dd>
1491 <dt class="hdlist1">
1492 notes
1493 </dt>
1494 <dd>
1496 Require that the backend support the <em>notemodify</em> (N)
1497 subcommand to the <em>commit</em> command.
1498 Versions of fast-import not supporting notes will exit
1499 with a message indicating so.
1500 </p>
1501 </dd>
1502 </dl></div>
1503 <h3 id="_tt_option_tt"><tt>option</tt></h3><div style="clear:left"></div>
1504 <div class="paragraph"><p>Processes the specified option so that git fast-import behaves in a
1505 way that suits the frontend&#8217;s needs.
1506 Note that options specified by the frontend are overridden by any
1507 options the user may specify to git fast-import itself.</p></div>
1508 <div class="literalblock">
1509 <div class="content">
1510 <pre><tt> 'option' SP &lt;option&gt; LF</tt></pre>
1511 </div></div>
1512 <div class="paragraph"><p>The <tt>&lt;option&gt;</tt> part of the command may contain any of the options
1513 listed in the OPTIONS section that do not change import semantics,
1514 without the leading <em>--</em> and is treated in the same way.</p></div>
1515 <div class="paragraph"><p>Option commands must be the first commands on the input (not counting
1516 feature commands), to give an option command after any non-option
1517 command is an error.</p></div>
1518 <div class="paragraph"><p>The following commandline options change import semantics and may therefore
1519 not be passed as option:</p></div>
1520 <div class="ulist"><ul>
1521 <li>
1523 date-format
1524 </p>
1525 </li>
1526 <li>
1528 import-marks
1529 </p>
1530 </li>
1531 <li>
1533 export-marks
1534 </p>
1535 </li>
1536 <li>
1538 cat-blob-fd
1539 </p>
1540 </li>
1541 <li>
1543 force
1544 </p>
1545 </li>
1546 </ul></div>
1547 </div>
1548 <h2 id="_crash_reports">Crash Reports</h2>
1549 <div class="sectionbody">
1550 <div class="paragraph"><p>If fast-import is supplied invalid input it will terminate with a
1551 non-zero exit status and create a crash report in the top level of
1552 the Git repository it was importing into. Crash reports contain
1553 a snapshot of the internal fast-import state as well as the most
1554 recent commands that lead up to the crash.</p></div>
1555 <div class="paragraph"><p>All recent commands (including stream comments, file changes and
1556 progress commands) are shown in the command history within the crash
1557 report, but raw file data and commit messages are excluded from the
1558 crash report. This exclusion saves space within the report file
1559 and reduces the amount of buffering that fast-import must perform
1560 during execution.</p></div>
1561 <div class="paragraph"><p>After writing a crash report fast-import will close the current
1562 packfile and export the marks table. This allows the frontend
1563 developer to inspect the repository state and resume the import from
1564 the point where it crashed. The modified branches and tags are not
1565 updated during a crash, as the import did not complete successfully.
1566 Branch and tag information can be found in the crash report and
1567 must be applied manually if the update is needed.</p></div>
1568 <div class="paragraph"><p>An example crash:</p></div>
1569 <div class="exampleblock">
1570 <div class="exampleblock-content">
1571 <div class="literalblock">
1572 <div class="content">
1573 <pre><tt>$ cat &gt;in &lt;&lt;END_OF_INPUT
1574 # my very first test commit
1575 commit refs/heads/master
1576 committer Shawn O. Pearce &lt;spearce&gt; 19283 -0400
1577 # who is that guy anyway?
1578 data &lt;&lt;EOF
1579 this is my commit
1581 M 644 inline .gitignore
1582 data &lt;&lt;EOF
1583 .gitignore
1585 M 777 inline bob
1586 END_OF_INPUT</tt></pre>
1587 </div></div>
1588 <div class="literalblock">
1589 <div class="content">
1590 <pre><tt>$ git fast-import &lt;in
1591 fatal: Corrupt mode: M 777 inline bob
1592 fast-import: dumping crash report to .git/fast_import_crash_8434</tt></pre>
1593 </div></div>
1594 <div class="literalblock">
1595 <div class="content">
1596 <pre><tt>$ cat .git/fast_import_crash_8434
1597 fast-import crash report:
1598 fast-import process: 8434
1599 parent process : 1391
1600 at Sat Sep 1 00:58:12 2007</tt></pre>
1601 </div></div>
1602 <div class="literalblock">
1603 <div class="content">
1604 <pre><tt>fatal: Corrupt mode: M 777 inline bob</tt></pre>
1605 </div></div>
1606 <div class="literalblock">
1607 <div class="content">
1608 <pre><tt>Most Recent Commands Before Crash
1609 ---------------------------------
1610 # my very first test commit
1611 commit refs/heads/master
1612 committer Shawn O. Pearce &lt;spearce&gt; 19283 -0400
1613 # who is that guy anyway?
1614 data &lt;&lt;EOF
1615 M 644 inline .gitignore
1616 data &lt;&lt;EOF
1617 * M 777 inline bob</tt></pre>
1618 </div></div>
1619 <div class="literalblock">
1620 <div class="content">
1621 <pre><tt>Active Branch LRU
1622 -----------------
1623 active_branches = 1 cur, 5 max</tt></pre>
1624 </div></div>
1625 <div class="literalblock">
1626 <div class="content">
1627 <pre><tt>pos clock name
1628 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1629 1) 0 refs/heads/master</tt></pre>
1630 </div></div>
1631 <div class="literalblock">
1632 <div class="content">
1633 <pre><tt>Inactive Branches
1634 -----------------
1635 refs/heads/master:
1636 status : active loaded dirty
1637 tip commit : 0000000000000000000000000000000000000000
1638 old tree : 0000000000000000000000000000000000000000
1639 cur tree : 0000000000000000000000000000000000000000
1640 commit clock: 0
1641 last pack :</tt></pre>
1642 </div></div>
1643 <div class="literalblock">
1644 <div class="content">
1645 <pre><tt>-------------------
1646 END OF CRASH REPORT</tt></pre>
1647 </div></div>
1648 </div></div>
1649 </div>
1650 <h2 id="_tips_and_tricks">Tips and Tricks</h2>
1651 <div class="sectionbody">
1652 <div class="paragraph"><p>The following tips and tricks have been collected from various
1653 users of fast-import, and are offered here as suggestions.</p></div>
1654 <h3 id="_use_one_mark_per_commit">Use One Mark Per Commit</h3><div style="clear:left"></div>
1655 <div class="paragraph"><p>When doing a repository conversion, use a unique mark per commit
1656 (<tt>mark :&lt;n&gt;</tt>) and supply the --export-marks option on the command
1657 line. fast-import will dump a file which lists every mark and the Git
1658 object SHA-1 that corresponds to it. If the frontend can tie
1659 the marks back to the source repository, it is easy to verify the
1660 accuracy and completeness of the import by comparing each Git
1661 commit to the corresponding source revision.</p></div>
1662 <div class="paragraph"><p>Coming from a system such as Perforce or Subversion this should be
1663 quite simple, as the fast-import mark can also be the Perforce changeset
1664 number or the Subversion revision number.</p></div>
1665 <h3 id="_freely_skip_around_branches">Freely Skip Around Branches</h3><div style="clear:left"></div>
1666 <div class="paragraph"><p>Don&#8217;t bother trying to optimize the frontend to stick to one branch
1667 at a time during an import. Although doing so might be slightly
1668 faster for fast-import, it tends to increase the complexity of the frontend
1669 code considerably.</p></div>
1670 <div class="paragraph"><p>The branch LRU builtin to fast-import tends to behave very well, and the
1671 cost of activating an inactive branch is so low that bouncing around
1672 between branches has virtually no impact on import performance.</p></div>
1673 <h3 id="_handling_renames">Handling Renames</h3><div style="clear:left"></div>
1674 <div class="paragraph"><p>When importing a renamed file or directory, simply delete the old
1675 name(s) and modify the new name(s) during the corresponding commit.
1676 Git performs rename detection after-the-fact, rather than explicitly
1677 during a commit.</p></div>
1678 <h3 id="_use_tag_fixup_branches">Use Tag Fixup Branches</h3><div style="clear:left"></div>
1679 <div class="paragraph"><p>Some other SCM systems let the user create a tag from multiple
1680 files which are not from the same commit/changeset. Or to create
1681 tags which are a subset of the files available in the repository.</p></div>
1682 <div class="paragraph"><p>Importing these tags as-is in Git is impossible without making at
1683 least one commit which &#8220;fixes up&#8221; the files to match the content
1684 of the tag. Use fast-import&#8217;s <tt>reset</tt> command to reset a dummy branch
1685 outside of your normal branch space to the base commit for the tag,
1686 then commit one or more file fixup commits, and finally tag the
1687 dummy branch.</p></div>
1688 <div class="paragraph"><p>For example since all normal branches are stored under <tt>refs/heads/</tt>
1689 name the tag fixup branch <tt>TAG_FIXUP</tt>. This way it is impossible for
1690 the fixup branch used by the importer to have namespace conflicts
1691 with real branches imported from the source (the name <tt>TAG_FIXUP</tt>
1692 is not <tt>refs/heads/TAG_FIXUP</tt>).</p></div>
1693 <div class="paragraph"><p>When committing fixups, consider using <tt>merge</tt> to connect the
1694 commit(s) which are supplying file revisions to the fixup branch.
1695 Doing so will allow tools such as <em>git blame</em> to track
1696 through the real commit history and properly annotate the source
1697 files.</p></div>
1698 <div class="paragraph"><p>After fast-import terminates the frontend will need to do <tt>rm .git/TAG_FIXUP</tt>
1699 to remove the dummy branch.</p></div>
1700 <h3 id="_import_now_repack_later">Import Now, Repack Later</h3><div style="clear:left"></div>
1701 <div class="paragraph"><p>As soon as fast-import completes the Git repository is completely valid
1702 and ready for use. Typically this takes only a very short time,
1703 even for considerably large projects (100,000+ commits).</p></div>
1704 <div class="paragraph"><p>However repacking the repository is necessary to improve data
1705 locality and access performance. It can also take hours on extremely
1706 large projects (especially if -f and a large --window parameter is
1707 used). Since repacking is safe to run alongside readers and writers,
1708 run the repack in the background and let it finish when it finishes.
1709 There is no reason to wait to explore your new Git project!</p></div>
1710 <div class="paragraph"><p>If you choose to wait for the repack, don&#8217;t try to run benchmarks
1711 or performance tests until repacking is completed. fast-import outputs
1712 suboptimal packfiles that are simply never seen in real use
1713 situations.</p></div>
1714 <h3 id="_repacking_historical_data">Repacking Historical Data</h3><div style="clear:left"></div>
1715 <div class="paragraph"><p>If you are repacking very old imported data (e.g. older than the
1716 last year), consider expending some extra CPU time and supplying
1717 --window=50 (or higher) when you run <em>git repack</em>.
1718 This will take longer, but will also produce a smaller packfile.
1719 You only need to expend the effort once, and everyone using your
1720 project will benefit from the smaller repository.</p></div>
1721 <h3 id="_include_some_progress_messages">Include Some Progress Messages</h3><div style="clear:left"></div>
1722 <div class="paragraph"><p>Every once in a while have your frontend emit a <tt>progress</tt> message
1723 to fast-import. The contents of the messages are entirely free-form,
1724 so one suggestion would be to output the current month and year
1725 each time the current commit date moves into the next month.
1726 Your users will feel better knowing how much of the data stream
1727 has been processed.</p></div>
1728 </div>
1729 <h2 id="_packfile_optimization">Packfile Optimization</h2>
1730 <div class="sectionbody">
1731 <div class="paragraph"><p>When packing a blob fast-import always attempts to deltify against the last
1732 blob written. Unless specifically arranged for by the frontend,
1733 this will probably not be a prior version of the same file, so the
1734 generated delta will not be the smallest possible. The resulting
1735 packfile will be compressed, but will not be optimal.</p></div>
1736 <div class="paragraph"><p>Frontends which have efficient access to all revisions of a
1737 single file (for example reading an RCS/CVS ,v file) can choose
1738 to supply all revisions of that file as a sequence of consecutive
1739 <tt>blob</tt> commands. This allows fast-import to deltify the different file
1740 revisions against each other, saving space in the final packfile.
1741 Marks can be used to later identify individual file revisions during
1742 a sequence of <tt>commit</tt> commands.</p></div>
1743 <div class="paragraph"><p>The packfile(s) created by fast-import do not encourage good disk access
1744 patterns. This is caused by fast-import writing the data in the order
1745 it is received on standard input, while Git typically organizes
1746 data within packfiles to make the most recent (current tip) data
1747 appear before historical data. Git also clusters commits together,
1748 speeding up revision traversal through better cache locality.</p></div>
1749 <div class="paragraph"><p>For this reason it is strongly recommended that users repack the
1750 repository with <tt>git repack -a -d</tt> after fast-import completes, allowing
1751 Git to reorganize the packfiles for faster data access. If blob
1752 deltas are suboptimal (see above) then also adding the <tt>-f</tt> option
1753 to force recomputation of all deltas can significantly reduce the
1754 final packfile size (30-50% smaller can be quite typical).</p></div>
1755 </div>
1756 <h2 id="_memory_utilization">Memory Utilization</h2>
1757 <div class="sectionbody">
1758 <div class="paragraph"><p>There are a number of factors which affect how much memory fast-import
1759 requires to perform an import. Like critical sections of core
1760 Git, fast-import uses its own memory allocators to amortize any overheads
1761 associated with malloc. In practice fast-import tends to amortize any
1762 malloc overheads to 0, due to its use of large block allocations.</p></div>
1763 <h3 id="_per_object">per object</h3><div style="clear:left"></div>
1764 <div class="paragraph"><p>fast-import maintains an in-memory structure for every object written in
1765 this execution. On a 32 bit system the structure is 32 bytes,
1766 on a 64 bit system the structure is 40 bytes (due to the larger
1767 pointer sizes). Objects in the table are not deallocated until
1768 fast-import terminates. Importing 2 million objects on a 32 bit system
1769 will require approximately 64 MiB of memory.</p></div>
1770 <div class="paragraph"><p>The object table is actually a hashtable keyed on the object name
1771 (the unique SHA-1). This storage configuration allows fast-import to reuse
1772 an existing or already written object and avoid writing duplicates
1773 to the output packfile. Duplicate blobs are surprisingly common
1774 in an import, typically due to branch merges in the source.</p></div>
1775 <h3 id="_per_mark">per mark</h3><div style="clear:left"></div>
1776 <div class="paragraph"><p>Marks are stored in a sparse array, using 1 pointer (4 bytes or 8
1777 bytes, depending on pointer size) per mark. Although the array
1778 is sparse, frontends are still strongly encouraged to use marks
1779 between 1 and n, where n is the total number of marks required for
1780 this import.</p></div>
1781 <h3 id="_per_branch">per branch</h3><div style="clear:left"></div>
1782 <div class="paragraph"><p>Branches are classified as active and inactive. The memory usage
1783 of the two classes is significantly different.</p></div>
1784 <div class="paragraph"><p>Inactive branches are stored in a structure which uses 96 or 120
1785 bytes (32 bit or 64 bit systems, respectively), plus the length of
1786 the branch name (typically under 200 bytes), per branch. fast-import will
1787 easily handle as many as 10,000 inactive branches in under 2 MiB
1788 of memory.</p></div>
1789 <div class="paragraph"><p>Active branches have the same overhead as inactive branches, but
1790 also contain copies of every tree that has been recently modified on
1791 that branch. If subtree <tt>include</tt> has not been modified since the
1792 branch became active, its contents will not be loaded into memory,
1793 but if subtree <tt>src</tt> has been modified by a commit since the branch
1794 became active, then its contents will be loaded in memory.</p></div>
1795 <div class="paragraph"><p>As active branches store metadata about the files contained on that
1796 branch, their in-memory storage size can grow to a considerable size
1797 (see below).</p></div>
1798 <div class="paragraph"><p>fast-import automatically moves active branches to inactive status based on
1799 a simple least-recently-used algorithm. The LRU chain is updated on
1800 each <tt>commit</tt> command. The maximum number of active branches can be
1801 increased or decreased on the command line with --active-branches=.</p></div>
1802 <h3 id="_per_active_tree">per active tree</h3><div style="clear:left"></div>
1803 <div class="paragraph"><p>Trees (aka directories) use just 12 bytes of memory on top of the
1804 memory required for their entries (see &#8220;per active file&#8221; below).
1805 The cost of a tree is virtually 0, as its overhead amortizes out
1806 over the individual file entries.</p></div>
1807 <h3 id="_per_active_file_entry">per active file entry</h3><div style="clear:left"></div>
1808 <div class="paragraph"><p>Files (and pointers to subtrees) within active trees require 52 or 64
1809 bytes (32/64 bit platforms) per entry. To conserve space, file and
1810 tree names are pooled in a common string table, allowing the filename
1811 &#8220;Makefile&#8221; to use just 16 bytes (after including the string header
1812 overhead) no matter how many times it occurs within the project.</p></div>
1813 <div class="paragraph"><p>The active branch LRU, when coupled with the filename string pool
1814 and lazy loading of subtrees, allows fast-import to efficiently import
1815 projects with 2,000+ branches and 45,114+ files in a very limited
1816 memory footprint (less than 2.7 MiB per active branch).</p></div>
1817 </div>
1818 <h2 id="_signals">Signals</h2>
1819 <div class="sectionbody">
1820 <div class="paragraph"><p>Sending <strong>SIGUSR1</strong> to the <em>git fast-import</em> process ends the current
1821 packfile early, simulating a <tt>checkpoint</tt> command. The impatient
1822 operator can use this facility to peek at the objects and refs from an
1823 import in progress, at the cost of some added running time and worse
1824 compression.</p></div>
1825 </div>
1826 <h2 id="_author">Author</h2>
1827 <div class="sectionbody">
1828 <div class="paragraph"><p>Written by Shawn O. Pearce &lt;<a href="mailto:spearce@spearce.org">spearce@spearce.org</a>&gt;.</p></div>
1829 </div>
1830 <h2 id="_documentation">Documentation</h2>
1831 <div class="sectionbody">
1832 <div class="paragraph"><p>Documentation by Shawn O. Pearce &lt;<a href="mailto:spearce@spearce.org">spearce@spearce.org</a>&gt;.</p></div>
1833 </div>
1834 <h2 id="_git">GIT</h2>
1835 <div class="sectionbody">
1836 <div class="paragraph"><p>Part of the <a href="git.html">git(1)</a> suite</p></div>
1837 </div>
1838 <div id="footer">
1839 <div id="footer-text">
1840 Last updated 2011-02-10 02:03:21 UTC
1841 </div>
1842 </div>
1843 </body>
1844 </html>