blob: 75b99dec4905dce896723d939ddf28781159ffac [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>
5<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
Junio C Hamano68cf15a2010-11-06 01:01:596<meta name="generator" content="AsciiDoc 8.4.5" />
7<title>git-fast-import(1)</title>
Junio C Hamanodf60f442007-02-07 05:52:378<style type="text/css">
9/* Debug borders */
10p, li, dt, dd, div, pre, h1, h2, h3, h4, h5, h6 {
11/*
12 border: 1px solid red;
13*/
14}
15
16body {
17 margin: 1em 5% 1em 5%;
18}
19
Junio C Hamanoba4b9282008-07-06 05:20:3120a {
21 color: blue;
22 text-decoration: underline;
23}
24a:visited {
25 color: fuchsia;
26}
Junio C Hamanodf60f442007-02-07 05:52:3727
28em {
29 font-style: italic;
Junio C Hamano68cf15a2010-11-06 01:01:5930 color: navy;
Junio C Hamanodf60f442007-02-07 05:52:3731}
32
33strong {
34 font-weight: bold;
Junio C Hamano68cf15a2010-11-06 01:01:5935 color: #083194;
Junio C Hamanodf60f442007-02-07 05:52:3736}
37
38tt {
39 color: navy;
40}
41
42h1, 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;
48}
49
Junio C Hamanoba4b9282008-07-06 05:20:3150h1, h2, h3 {
Junio C Hamanodf60f442007-02-07 05:52:3751 border-bottom: 2px solid silver;
52}
53h2 {
Junio C Hamanodf60f442007-02-07 05:52:3754 padding-top: 0.5em;
55}
Junio C Hamanoba4b9282008-07-06 05:20:3156h3 {
57 float: left;
58}
59h3 + * {
60 clear: left;
61}
Junio C Hamanodf60f442007-02-07 05:52:3762
63div.sectionbody {
64 font-family: serif;
65 margin-left: 0;
66}
67
68hr {
69 border: 1px solid silver;
70}
71
72p {
73 margin-top: 0.5em;
74 margin-bottom: 0.5em;
75}
76
Junio C Hamano68cf15a2010-11-06 01:01:5977ul, ol, li > p {
78 margin-top: 0;
79}
80
Junio C Hamanodf60f442007-02-07 05:52:3781pre {
82 padding: 0;
83 margin: 0;
84}
85
86span#author {
87 color: #527bbd;
88 font-family: sans-serif;
89 font-weight: bold;
Junio C Hamanoba4b9282008-07-06 05:20:3190 font-size: 1.1em;
Junio C Hamanodf60f442007-02-07 05:52:3791}
92span#email {
93}
Junio C Hamano68cf15a2010-11-06 01:01:5994span#revnumber, span#revdate, span#revremark {
Junio C Hamanodf60f442007-02-07 05:52:3795 font-family: sans-serif;
96}
97
98div#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;
104}
105div#footer-text {
106 float: left;
107 padding-bottom: 0.5em;
108}
109div#footer-badges {
110 float: right;
111 padding-bottom: 0.5em;
112}
113
Junio C Hamano68cf15a2010-11-06 01:01:59114div#preamble {
115 margin-top: 1.5em;
116 margin-bottom: 1.5em;
117}
Junio C Hamanodf60f442007-02-07 05:52:37118div.tableblock, div.imageblock, div.exampleblock, div.verseblock,
119div.quoteblock, div.literalblock, div.listingblock, div.sidebarblock,
120div.admonitionblock {
Junio C Hamanodf60f442007-02-07 05:52:37121 margin-top: 1.5em;
122 margin-bottom: 1.5em;
123}
124div.admonitionblock {
125 margin-top: 2.5em;
126 margin-bottom: 2.5em;
127}
128
129div.content { /* Block element content. */
130 padding: 0;
131}
132
133/* Block element titles. */
134div.title, caption.title {
Junio C Hamano68cf15a2010-11-06 01:01:59135 color: #527bbd;
Junio C Hamanodf60f442007-02-07 05:52:37136 font-family: sans-serif;
137 font-weight: bold;
138 text-align: left;
139 margin-top: 1.0em;
140 margin-bottom: 0.5em;
141}
142div.title + * {
143 margin-top: 0;
144}
145
146td div.title:first-child {
147 margin-top: 0.0em;
148}
149div.content div.title:first-child {
150 margin-top: 0.0em;
151}
152div.content + div.title {
153 margin-top: 0.0em;
154}
155
156div.sidebarblock > div.content {
157 background: #ffffee;
158 border: 1px solid silver;
159 padding: 0.5em;
160}
161
162div.listingblock > div.content {
163 border: 1px solid silver;
164 background: #f4f4f4;
165 padding: 0.5em;
166}
167
Junio C Hamano68cf15a2010-11-06 01:01:59168div.quoteblock {
Junio C Hamanodf60f442007-02-07 05:52:37169 padding-left: 2.0em;
Junio C Hamano68cf15a2010-11-06 01:01:59170 margin-right: 10%;
Junio C Hamanodf60f442007-02-07 05:52:37171}
Junio C Hamano68cf15a2010-11-06 01:01:59172div.quoteblock > div.attribution {
173 padding-top: 0.5em;
Junio C Hamanodf60f442007-02-07 05:52:37174 text-align: right;
175}
Junio C Hamano68cf15a2010-11-06 01:01:59176
177div.verseblock {
178 padding-left: 2.0em;
179 margin-right: 10%;
180}
181div.verseblock > div.content {
182 white-space: pre;
183}
184div.verseblock > div.attribution {
185 padding-top: 0.75em;
186 text-align: left;
187}
188/* DEPRECATED: Pre version 8.2.7 verse style literal block. */
Junio C Hamanoba4b9282008-07-06 05:20:31189div.verseblock + div.attribution {
190 text-align: left;
191}
Junio C Hamanodf60f442007-02-07 05:52:37192
193div.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;
200}
201div.admonitionblock td.content {
202 padding-left: 0.5em;
203 border-left: 2px solid silver;
204}
205
206div.exampleblock > div.content {
207 border-left: 2px solid silver;
208 padding: 0.5em;
209}
210
Junio C Hamanodf60f442007-02-07 05:52:37211div.imageblock div.content { padding-left: 0; }
Junio C Hamanodf60f442007-02-07 05:52:37212span.image img { border-style: none; }
Junio C Hamano68cf15a2010-11-06 01:01:59213a.image:visited { color: white; }
Junio C Hamanodf60f442007-02-07 05:52:37214
215dl {
216 margin-top: 0.8em;
217 margin-bottom: 0.8em;
218}
219dt {
220 margin-top: 0.5em;
221 margin-bottom: 0;
Junio C Hamano68cf15a2010-11-06 01:01:59222 font-style: normal;
223 color: navy;
Junio C Hamanodf60f442007-02-07 05:52:37224}
225dd > *:first-child {
Junio C Hamano68cf15a2010-11-06 01:01:59226 margin-top: 0.1em;
Junio C Hamanodf60f442007-02-07 05:52:37227}
228
229ul, ol {
230 list-style-position: outside;
231}
Junio C Hamano68cf15a2010-11-06 01:01:59232ol.arabic {
233 list-style-type: decimal;
234}
235ol.loweralpha {
Junio C Hamanodf60f442007-02-07 05:52:37236 list-style-type: lower-alpha;
237}
Junio C Hamano68cf15a2010-11-06 01:01:59238ol.upperalpha {
239 list-style-type: upper-alpha;
240}
241ol.lowerroman {
242 list-style-type: lower-roman;
243}
244ol.upperroman {
245 list-style-type: upper-roman;
246}
247
248div.compact ul, div.compact ol,
249div.compact p, div.compact p,
250div.compact div, div.compact div {
251 margin-top: 0.1em;
252 margin-bottom: 0.1em;
253}
Junio C Hamanodf60f442007-02-07 05:52:37254
255div.tableblock > table {
Junio C Hamanoba4b9282008-07-06 05:20:31256 border: 3px solid #527bbd;
Junio C Hamanodf60f442007-02-07 05:52:37257}
258thead {
259 font-family: sans-serif;
260 font-weight: bold;
261}
262tfoot {
263 font-weight: bold;
264}
Junio C Hamano68cf15a2010-11-06 01:01:59265td > div.verse {
266 white-space: pre;
267}
268p.table {
269 margin-top: 0;
270}
271/* Because the table frame attribute is overriden by CSS in most browsers. */
272div.tableblock > table[frame="void"] {
273 border-style: none;
274}
275div.tableblock > table[frame="hsides"] {
276 border-left-style: none;
277 border-right-style: none;
278}
279div.tableblock > table[frame="vsides"] {
280 border-top-style: none;
281 border-bottom-style: none;
282}
Junio C Hamanodf60f442007-02-07 05:52:37283
Junio C Hamano68cf15a2010-11-06 01:01:59284
285div.hdlist {
Junio C Hamanodf60f442007-02-07 05:52:37286 margin-top: 0.8em;
287 margin-bottom: 0.8em;
288}
Junio C Hamano68cf15a2010-11-06 01:01:59289div.hdlist tr {
290 padding-bottom: 15px;
Junio C Hamanoba4b9282008-07-06 05:20:31291}
Junio C Hamano68cf15a2010-11-06 01:01:59292dt.hdlist1.strong, td.hdlist1.strong {
293 font-weight: bold;
294}
295td.hdlist1 {
Junio C Hamanodf60f442007-02-07 05:52:37296 vertical-align: top;
Junio C Hamano68cf15a2010-11-06 01:01:59297 font-style: normal;
Junio C Hamanodf60f442007-02-07 05:52:37298 padding-right: 0.8em;
Junio C Hamano68cf15a2010-11-06 01:01:59299 color: navy;
Junio C Hamanodf60f442007-02-07 05:52:37300}
Junio C Hamano68cf15a2010-11-06 01:01:59301td.hdlist2 {
Junio C Hamanodf60f442007-02-07 05:52:37302 vertical-align: top;
303}
Junio C Hamano68cf15a2010-11-06 01:01:59304div.hdlist.compact tr {
305 margin: 0;
306 padding-bottom: 0;
307}
308
309.comment {
310 background: yellow;
311}
Junio C Hamanodf60f442007-02-07 05:52:37312
313@media print {
314 div#footer-badges { display: none; }
315}
Junio C Hamanoba4b9282008-07-06 05:20:31316
317div#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;
324}
325
326div.toclevel1, div.toclevel2, div.toclevel3, div.toclevel4 {
327 margin-top: 0;
328 margin-bottom: 0;
329}
330div.toclevel2 {
331 margin-left: 2em;
332 font-size: 0.9em;
333}
334div.toclevel3 {
335 margin-left: 4em;
336 font-size: 0.9em;
337}
338div.toclevel4 {
339 margin-left: 6em;
340 font-size: 0.9em;
341}
Junio C Hamano68cf15a2010-11-06 01:01:59342/* Overrides for manpage documents */
343h1 {
344 padding-top: 0.5em;
345 padding-bottom: 0.5em;
346 border-top: 2px solid silver;
347 border-bottom: 2px solid silver;
348}
349h2 {
350 border-style: none;
351}
352div.sectionbody {
353 margin-left: 5%;
354}
355
356@media print {
357 div#toc { display: none; }
358}
359
Junio C Hamanodf60f442007-02-07 05:52:37360/* Workarounds for IE6's broken and incomplete CSS2. */
361
362div.sidebar-content {
363 background: #ffffee;
364 border: 1px solid silver;
365 padding: 0.5em;
366}
367div.sidebar-title, div.image-title {
Junio C Hamano68cf15a2010-11-06 01:01:59368 color: #527bbd;
Junio C Hamanodf60f442007-02-07 05:52:37369 font-family: sans-serif;
370 font-weight: bold;
371 margin-top: 0.0em;
372 margin-bottom: 0.5em;
373}
374
375div.listingblock div.content {
376 border: 1px solid silver;
377 background: #f4f4f4;
378 padding: 0.5em;
379}
380
Junio C Hamano68cf15a2010-11-06 01:01:59381div.quoteblock-attribution {
382 padding-top: 0.5em;
383 text-align: right;
384}
385
386div.verseblock-content {
387 white-space: pre;
388}
389div.verseblock-attribution {
390 padding-top: 0.75em;
391 text-align: left;
Junio C Hamanodf60f442007-02-07 05:52:37392}
393
394div.exampleblock-content {
395 border-left: 2px solid silver;
396 padding-left: 0.5em;
397}
Junio C Hamanoba4b9282008-07-06 05:20:31398
399/* IE6 sets dynamically generated links as visited. */
400div#toc a:visited { color: blue; }
Junio C Hamanodf60f442007-02-07 05:52:37401</style>
Junio C Hamanodf60f442007-02-07 05:52:37402</head>
403<body>
404<div id="header">
405<h1>
406git-fast-import(1) Manual Page
407</h1>
408<h2>NAME</h2>
409<div class="sectionbody">
410<p>git-fast-import -
Junio C Hamano053827f2007-02-14 07:23:58411 Backend for fast Git data importers
Junio C Hamanodf60f442007-02-07 05:52:37412</p>
413</div>
414</div>
Junio C Hamano68cf15a2010-11-06 01:01:59415<h2 id="_synopsis">SYNOPSIS</h2>
Junio C Hamanodf60f442007-02-07 05:52:37416<div class="sectionbody">
Junio C Hamano68cf15a2010-11-06 01:01:59417<div class="paragraph"><p>frontend | <em>git fast-import</em> [options]</p></div>
Junio C Hamanodf60f442007-02-07 05:52:37418</div>
Junio C Hamanoba4b9282008-07-06 05:20:31419<h2 id="_description">DESCRIPTION</h2>
Junio C Hamanodf60f442007-02-07 05:52:37420<div class="sectionbody">
Junio C Hamano68cf15a2010-11-06 01:01:59421<div class="paragraph"><p>This program is usually not what the end user wants to run directly.
Junio C Hamanodf60f442007-02-07 05:52:37422Most end users want to use one of the existing frontend programs,
423which parses a specific type of foreign source and feeds the contents
Junio C Hamano1aa40d22010-01-21 17:46:43424stored there to <em>git fast-import</em>.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:59425<div class="paragraph"><p>fast-import reads a mixed command/data stream from standard input and
Junio C Hamanodf60f442007-02-07 05:52:37426writes one or more packfiles directly into the current repository.
427When EOF is received on standard input, fast import writes out
428updated branch and tag refs, fully updating the current repository
Junio C Hamanoba4b9282008-07-06 05:20:31429with the newly imported data.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:59430<div class="paragraph"><p>The fast-import backend itself can import into an empty repository (one that
Junio C Hamano1aa40d22010-01-21 17:46:43431has already been initialized by <em>git init</em>) or incrementally
Junio C Hamanodf60f442007-02-07 05:52:37432update an existing populated repository. Whether or not incremental
433imports are supported from a particular foreign source depends on
Junio C Hamanoba4b9282008-07-06 05:20:31434the frontend program in use.</p></div>
Junio C Hamanodf60f442007-02-07 05:52:37435</div>
Junio C Hamanoba4b9282008-07-06 05:20:31436<h2 id="_options">OPTIONS</h2>
Junio C Hamanodf60f442007-02-07 05:52:37437<div class="sectionbody">
Junio C Hamano68cf15a2010-11-06 01:01:59438<div class="dlist"><dl>
439<dt class="hdlist1">
Junio C Hamanodf60f442007-02-07 05:52:37440--date-format=&lt;fmt&gt;
441</dt>
442<dd>
443<p>
444 Specify the type of dates the frontend will supply to
Junio C Hamanod3339982007-02-09 08:38:48445 fast-import within <tt>author</tt>, <tt>committer</tt> and <tt>tagger</tt> commands.
Junio C Hamanodf60f442007-02-07 05:52:37446 See &#8220;Date Formats&#8221; below for details about which formats
447 are supported, and their syntax.
448</p>
449</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59450<dt class="hdlist1">
Junio C Hamanodf60f442007-02-07 05:52:37451--force
452</dt>
453<dd>
454<p>
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>
Junio C Hamano68cf15a2010-11-06 01:01:59460<dt class="hdlist1">
Junio C Hamanodf60f442007-02-07 05:52:37461--max-pack-size=&lt;n&gt;
462</dt>
463<dd>
464<p>
Junio C Hamanod3304322010-02-05 03:28:27465 Maximum size of each output packfile.
Junio C Hamano4fdccb22010-02-19 09:58:14466 The default is unlimited.
Junio C Hamanodf60f442007-02-07 05:52:37467</p>
468</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59469<dt class="hdlist1">
Junio C Hamano5c246f22010-02-03 07:34:53470--big-file-threshold=&lt;n&gt;
471</dt>
472<dd>
473<p>
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>
Junio C Hamano68cf15a2010-11-06 01:01:59480<dt class="hdlist1">
Junio C Hamanodf60f442007-02-07 05:52:37481--depth=&lt;n&gt;
482</dt>
483<dd>
484<p>
485 Maximum delta depth, for blob and tree deltification.
486 Default is 10.
487</p>
488</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59489<dt class="hdlist1">
Junio C Hamanodf60f442007-02-07 05:52:37490--active-branches=&lt;n&gt;
491</dt>
492<dd>
493<p>
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>
Junio C Hamano68cf15a2010-11-06 01:01:59498<dt class="hdlist1">
Junio C Hamanodf60f442007-02-07 05:52:37499--export-marks=&lt;file&gt;
500</dt>
501<dd>
502<p>
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
Junio C Hamanod15328a2007-03-09 09:06:40506 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>
Junio C Hamano68cf15a2010-11-06 01:01:59512<dt class="hdlist1">
Junio C Hamanod15328a2007-03-09 09:06:40513--import-marks=&lt;file&gt;
514</dt>
515<dd>
516<p>
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.
Junio C Hamanodf60f442007-02-07 05:52:37523</p>
524</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59525<dt class="hdlist1">
Junio C Hamano6ce6b6c2010-01-18 01:25:50526--relative-marks
527</dt>
528<dd>
529<p>
530 After specifying --relative-marks= the paths specified
531 with --import-marks= and --export-marks= are relative
532 to an internal directory in the current repository.
533 In git-fast-import this means that the paths are relative
534 to the .git/info/fast-import directory. However, other
535 importers may use a different location.
536</p>
537</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59538<dt class="hdlist1">
Junio C Hamano6ce6b6c2010-01-18 01:25:50539--no-relative-marks
540</dt>
541<dd>
542<p>
543 Negates a previous --relative-marks. Allows for combining
544 relative and non-relative marks by interweaving
545 --(no-)-relative-marks= with the --(import|export)-marks=
546 options.
547</p>
548</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59549<dt class="hdlist1">
Junio C Hamano9dd8bb02007-02-12 07:15:35550--export-pack-edges=&lt;file&gt;
551</dt>
552<dd>
553<p>
554 After creating a packfile, print a line of data to
555 &lt;file&gt; listing the filename of the packfile and the last
556 commit on each branch that was written to that packfile.
557 This information may be useful after importing projects
558 whose total object set exceeds the 4 GiB packfile limit,
559 as these commits can be used as edge points during calls
Junio C Hamano1aa40d22010-01-21 17:46:43560 to <em>git pack-objects</em>.
Junio C Hamano9dd8bb02007-02-12 07:15:35561</p>
562</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59563<dt class="hdlist1">
Junio C Hamanodfc4ce72007-02-07 23:17:29564--quiet
565</dt>
566<dd>
567<p>
Junio C Hamanod3339982007-02-09 08:38:48568 Disable all non-fatal output, making fast-import silent when it
Junio C Hamanodfc4ce72007-02-07 23:17:29569 is successful. This option disables the output shown by
570 --stats.
571</p>
572</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59573<dt class="hdlist1">
Junio C Hamanodfc4ce72007-02-07 23:17:29574--stats
575</dt>
576<dd>
577<p>
Junio C Hamanod3339982007-02-09 08:38:48578 Display some basic statistics about the objects fast-import has
Junio C Hamanodfc4ce72007-02-07 23:17:29579 created, the packfiles they were stored into, and the
Junio C Hamanod3339982007-02-09 08:38:48580 memory used by fast-import during this run. Showing this output
Junio C Hamanodfc4ce72007-02-07 23:17:29581 is currently the default, but can be disabled with --quiet.
582</p>
583</dd>
Junio C Hamanoba4b9282008-07-06 05:20:31584</dl></div>
Junio C Hamanodf60f442007-02-07 05:52:37585</div>
Junio C Hamanoba4b9282008-07-06 05:20:31586<h2 id="_performance">Performance</h2>
Junio C Hamanodf60f442007-02-07 05:52:37587<div class="sectionbody">
Junio C Hamano68cf15a2010-11-06 01:01:59588<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:37589amount of memory usage and processing time. Assuming the frontend
Junio C Hamanod3339982007-02-09 08:38:48590is able to keep up with fast-import and feed it a constant stream of data,
Junio C Hamanodf60f442007-02-07 05:52:37591import times for projects holding 10+ years of history and containing
592100,000+ individual commits are generally completed in just 1-2
Junio C Hamanoba4b9282008-07-06 05:20:31593hours on quite modest (~$2,000 USD) hardware.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:59594<div class="paragraph"><p>Most bottlenecks appear to be in foreign source data access (the
Junio C Hamanod3339982007-02-09 08:38:48595source just cannot extract revisions fast enough) or disk IO (fast-import
Junio C Hamanodf60f442007-02-07 05:52:37596writes as fast as the disk will take the data). Imports will run
597faster if the source data is stored on a different drive than the
Junio C Hamanoba4b9282008-07-06 05:20:31598destination Git repository (due to less IO contention).</p></div>
Junio C Hamanodf60f442007-02-07 05:52:37599</div>
Junio C Hamanoba4b9282008-07-06 05:20:31600<h2 id="_development_cost">Development Cost</h2>
Junio C Hamanodf60f442007-02-07 05:52:37601<div class="sectionbody">
Junio C Hamano68cf15a2010-11-06 01:01:59602<div class="paragraph"><p>A typical frontend for fast-import tends to weigh in at approximately 200
Junio C Hamanodf60f442007-02-07 05:52:37603lines of Perl/Python/Ruby code. Most developers have been able to
604create working importers in just a couple of hours, even though it
Junio C Hamanod3339982007-02-09 08:38:48605is their first exposure to fast-import, and sometimes even to Git. This is
Junio C Hamanodf60f442007-02-07 05:52:37606an ideal situation, given that most conversion tools are throw-away
Junio C Hamanoba4b9282008-07-06 05:20:31607(use once, and never look back).</p></div>
Junio C Hamanodf60f442007-02-07 05:52:37608</div>
Junio C Hamanoba4b9282008-07-06 05:20:31609<h2 id="_parallel_operation">Parallel Operation</h2>
Junio C Hamanodf60f442007-02-07 05:52:37610<div class="sectionbody">
Junio C Hamano68cf15a2010-11-06 01:01:59611<div class="paragraph"><p>Like <em>git push</em> or <em>git fetch</em>, imports handled by fast-import are safe to
Junio C Hamanodf60f442007-02-07 05:52:37612run alongside parallel <tt>git repack -a -d</tt> or <tt>git gc</tt> invocations,
Junio C Hamano1aa40d22010-01-21 17:46:43613or any other Git operation (including <em>git prune</em>, as loose objects
Junio C Hamanoba4b9282008-07-06 05:20:31614are never used by fast-import).</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:59615<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:48616After the import, during its ref update phase, fast-import tests each
Junio C Hamanodf60f442007-02-07 05:52:37617existing branch ref to verify the update will be a fast-forward
618update (the commit stored in the ref is contained in the new
619history of the commit to be written). If the update is not a
Junio C Hamanod3339982007-02-09 08:38:48620fast-forward update, fast-import will skip updating that ref and instead
621prints a warning message. fast-import will always attempt to update all
Junio C Hamanoba4b9282008-07-06 05:20:31622branch refs, and does not stop on the first failure.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:59623<div class="paragraph"><p>Branch updates can be forced with --force, but it&#8217;s recommended that
Junio C Hamanodfc4ce72007-02-07 23:17:29624this only be used on an otherwise quiet repository. Using --force
Junio C Hamanoba4b9282008-07-06 05:20:31625is not necessary for an initial import into an empty repository.</p></div>
Junio C Hamanodf60f442007-02-07 05:52:37626</div>
Junio C Hamanoba4b9282008-07-06 05:20:31627<h2 id="_technical_discussion">Technical Discussion</h2>
Junio C Hamanodf60f442007-02-07 05:52:37628<div class="sectionbody">
Junio C Hamano68cf15a2010-11-06 01:01:59629<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:37630or modified at any point during the import process by sending a
631<tt>commit</tt> command on the input stream. This design allows a frontend
632program to process an unlimited number of branches simultaneously,
633generating commits in the order they are available from the source
Junio C Hamanoba4b9282008-07-06 05:20:31634data. It also simplifies the frontend programs considerably.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:59635<div class="paragraph"><p>fast-import does not use or alter the current working directory, or any
Junio C Hamanodf60f442007-02-07 05:52:37636file within it. (It does however update the current Git repository,
637as referenced by <tt>GIT_DIR</tt>.) Therefore an import frontend may use
638the working directory for its own purposes, such as extracting file
639revisions from the foreign source. This ignorance of the working
Junio C Hamanod3339982007-02-09 08:38:48640directory also allows fast-import to run very quickly, as it does not
Junio C Hamanodf60f442007-02-07 05:52:37641need to perform any costly file update operations when switching
Junio C Hamanoba4b9282008-07-06 05:20:31642between branches.</p></div>
Junio C Hamanodf60f442007-02-07 05:52:37643</div>
Junio C Hamanoba4b9282008-07-06 05:20:31644<h2 id="_input_format">Input Format</h2>
Junio C Hamanodf60f442007-02-07 05:52:37645<div class="sectionbody">
Junio C Hamano68cf15a2010-11-06 01:01:59646<div class="paragraph"><p>With the exception of raw file data (which Git does not interpret)
Junio C Hamanod3339982007-02-09 08:38:48647the fast-import input format is text (ASCII) based. This text based
Junio C Hamanodf60f442007-02-07 05:52:37648format simplifies development and debugging of frontend programs,
649especially when a higher level language such as Perl, Python or
Junio C Hamanoba4b9282008-07-06 05:20:31650Ruby is being used.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:59651<div class="paragraph"><p>fast-import is very strict about its input. Where we say SP below we mean
Junio C Hamanodf60f442007-02-07 05:52:37652<strong>exactly</strong> one space. Likewise LF means one (and only one) linefeed.
653Supplying additional whitespace characters will cause unexpected
654results, such as branch names or file names with leading or trailing
Junio C Hamanod3339982007-02-09 08:38:48655spaces in their name, or early termination of fast-import when it encounters
Junio C Hamanoba4b9282008-07-06 05:20:31656unexpected input.</p></div>
657<h3 id="_stream_comments">Stream Comments</h3><div style="clear:left"></div>
Junio C Hamano68cf15a2010-11-06 01:01:59658<div class="paragraph"><p>To aid in debugging frontends fast-import ignores any line that
Junio C Hamanoe52cf782007-08-19 19:15:52659begins with <tt>#</tt> (ASCII pound/hash) up to and including the line
660ending <tt>LF</tt>. A comment line may contain any sequence of bytes
661that does not contain an LF and therefore may be used to include
662any detailed debugging information that might be specific to the
Junio C Hamanoba4b9282008-07-06 05:20:31663frontend and useful when inspecting a fast-import data stream.</p></div>
664<h3 id="_date_formats">Date Formats</h3><div style="clear:left"></div>
Junio C Hamano68cf15a2010-11-06 01:01:59665<div class="paragraph"><p>The following date formats are supported. A frontend should select
Junio C Hamanodf60f442007-02-07 05:52:37666the format it will use for this import by passing the format name
Junio C Hamanoba4b9282008-07-06 05:20:31667in the --date-format=&lt;fmt&gt; command line option.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:59668<div class="dlist"><dl>
669<dt class="hdlist1">
Junio C Hamanodf60f442007-02-07 05:52:37670<tt>raw</tt>
671</dt>
672<dd>
673<p>
Junio C Hamanodfc4ce72007-02-07 23:17:29674 This is the Git native format and is <tt>&lt;time&gt; SP &lt;offutc&gt;</tt>.
Junio C Hamano68cf15a2010-11-06 01:01:59675 It is also fast-import&#8217;s default format, if --date-format was
Junio C Hamanodf60f442007-02-07 05:52:37676 not specified.
677</p>
Junio C Hamano68cf15a2010-11-06 01:01:59678<div class="paragraph"><p>The time of the event is specified by <tt>&lt;time&gt;</tt> as the number of
Junio C Hamanodf60f442007-02-07 05:52:37679seconds since the UNIX epoch (midnight, Jan 1, 1970, UTC) and is
Junio C Hamanoba4b9282008-07-06 05:20:31680written as an ASCII decimal integer.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:59681<div class="paragraph"><p>The local offset is specified by <tt>&lt;offutc&gt;</tt> as a positive or negative
Junio C Hamanodfc4ce72007-02-07 23:17:29682offset from UTC. For example EST (which is 5 hours behind UTC)
683would be expressed in <tt>&lt;tz&gt;</tt> by &#8220;-0500&#8221; while UTC is &#8220;+0000&#8221;.
684The local offset does not affect <tt>&lt;time&gt;</tt>; it is used only as an
Junio C Hamanoba4b9282008-07-06 05:20:31685advisement to help formatting routines display the timestamp.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:59686<div class="paragraph"><p>If the local offset is not available in the source material, use
Junio C Hamanodfc4ce72007-02-07 23:17:29687&#8220;+0000&#8221;, or the most common local offset. For example many
Junio C Hamanodf60f442007-02-07 05:52:37688organizations have a CVS repository which has only ever been accessed
689by users who are located in the same location and timezone. In this
Junio C Hamanoba4b9282008-07-06 05:20:31690case a reasonable offset from UTC could be assumed.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:59691<div class="paragraph"><p>Unlike the <tt>rfc2822</tt> format, this format is very strict. Any
Junio C Hamanoba4b9282008-07-06 05:20:31692variation in formatting will cause fast-import to reject the value.</p></div>
Junio C Hamanodf60f442007-02-07 05:52:37693</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59694<dt class="hdlist1">
Junio C Hamanodf60f442007-02-07 05:52:37695<tt>rfc2822</tt>
696</dt>
697<dd>
698<p>
699 This is the standard email format as described by RFC 2822.
700</p>
Junio C Hamano68cf15a2010-11-06 01:01:59701<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:48702parser is accurate, but a little on the lenient side. It is the
Junio C Hamano1aa40d22010-01-21 17:46:43703same parser used by <em>git am</em> when applying patches
Junio C Hamanoba4b9282008-07-06 05:20:31704received from email.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:59705<div class="paragraph"><p>Some malformed strings may be accepted as valid dates. In some of
Junio C Hamanodf60f442007-02-07 05:52:37706these cases Git will still be able to obtain the correct date from
707the malformed string. There are also some types of malformed
708strings which Git will parse wrong, and yet consider valid.
Junio C Hamanoba4b9282008-07-06 05:20:31709Seriously malformed strings will be rejected.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:59710<div class="paragraph"><p>Unlike the <tt>raw</tt> format above, the timezone/UTC offset information
Junio C Hamanodfc4ce72007-02-07 23:17:29711contained in an RFC 2822 date string is used to adjust the date
712value to UTC prior to storage. Therefore it is important that
Junio C Hamanoba4b9282008-07-06 05:20:31713this information be as accurate as possible.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:59714<div class="paragraph"><p>If the source material uses RFC 2822 style dates,
Junio C Hamanod3339982007-02-09 08:38:48715the frontend should let fast-import handle the parsing and conversion
Junio C Hamanodf60f442007-02-07 05:52:37716(rather than attempting to do it itself) as the Git parser has
Junio C Hamanoba4b9282008-07-06 05:20:31717been well tested in the wild.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:59718<div class="paragraph"><p>Frontends should prefer the <tt>raw</tt> format if the source material
Junio C Hamanod3339982007-02-09 08:38:48719already uses UNIX-epoch format, can be coaxed to give dates in that
Junio C Hamanoa6387422007-08-25 03:54:27720format, or its format is easily convertible to it, as there is no
Junio C Hamanoba4b9282008-07-06 05:20:31721ambiguity in parsing.</p></div>
Junio C Hamanodf60f442007-02-07 05:52:37722</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59723<dt class="hdlist1">
Junio C Hamanodf60f442007-02-07 05:52:37724<tt>now</tt>
725</dt>
726<dd>
727<p>
728 Always use the current time and timezone. The literal
729 <tt>now</tt> must always be supplied for <tt>&lt;when&gt;</tt>.
730</p>
Junio C Hamano68cf15a2010-11-06 01:01:59731<div class="paragraph"><p>This is a toy format. The current time and timezone of this system
Junio C Hamanodf60f442007-02-07 05:52:37732is always copied into the identity string at the time it is being
Junio C Hamanod3339982007-02-09 08:38:48733created by fast-import. There is no way to specify a different time or
Junio C Hamanoba4b9282008-07-06 05:20:31734timezone.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:59735<div class="paragraph"><p>This particular format is supplied as it&#8217;s short to implement and
Junio C Hamanodf60f442007-02-07 05:52:37736may be useful to a process that wants to create a new commit
737right now, without needing to use a working directory or
Junio C Hamano1aa40d22010-01-21 17:46:43738<em>git update-index</em>.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:59739<div class="paragraph"><p>If separate <tt>author</tt> and <tt>committer</tt> commands are used in a <tt>commit</tt>
Junio C Hamanodf60f442007-02-07 05:52:37740the timestamps may not match, as the system clock will be polled
741twice (once for each command). The only way to ensure that both
742author and committer identity information has the same timestamp
743is to omit <tt>author</tt> (thus copying from <tt>committer</tt>) or to use a
Junio C Hamanoba4b9282008-07-06 05:20:31744date format other than <tt>now</tt>.</p></div>
Junio C Hamanodf60f442007-02-07 05:52:37745</dd>
Junio C Hamanoba4b9282008-07-06 05:20:31746</dl></div>
747<h3 id="_commands">Commands</h3><div style="clear:left"></div>
Junio C Hamano68cf15a2010-11-06 01:01:59748<div class="paragraph"><p>fast-import accepts several commands to update the current repository
Junio C Hamanodf60f442007-02-07 05:52:37749and control the current import process. More detailed discussion
Junio C Hamanoba4b9282008-07-06 05:20:31750(with examples) of each command follows later.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:59751<div class="dlist"><dl>
752<dt class="hdlist1">
Junio C Hamanodf60f442007-02-07 05:52:37753<tt>commit</tt>
754</dt>
755<dd>
756<p>
757 Creates a new branch or updates an existing branch by
758 creating a new commit and updating the branch to point at
759 the newly created commit.
760</p>
761</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59762<dt class="hdlist1">
Junio C Hamanodf60f442007-02-07 05:52:37763<tt>tag</tt>
764</dt>
765<dd>
766<p>
767 Creates an annotated tag object from an existing commit or
768 branch. Lightweight tags are not supported by this command,
769 as they are not recommended for recording meaningful points
770 in time.
771</p>
772</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59773<dt class="hdlist1">
Junio C Hamanodf60f442007-02-07 05:52:37774<tt>reset</tt>
775</dt>
776<dd>
777<p>
778 Reset an existing branch (or a new branch) to a specific
779 revision. This command must be used to change a branch to
780 a specific revision without making a commit on it.
781</p>
782</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59783<dt class="hdlist1">
Junio C Hamanodf60f442007-02-07 05:52:37784<tt>blob</tt>
785</dt>
786<dd>
787<p>
788 Convert raw file data into a blob, for future use in a
789 <tt>commit</tt> command. This command is optional and is not
790 needed to perform an import.
791</p>
792</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59793<dt class="hdlist1">
Junio C Hamanodf60f442007-02-07 05:52:37794<tt>checkpoint</tt>
795</dt>
796<dd>
797<p>
Junio C Hamanod3339982007-02-09 08:38:48798 Forces fast-import to close the current packfile, generate its
Junio C Hamanodf60f442007-02-07 05:52:37799 unique SHA-1 checksum and index, and start a new packfile.
800 This command is optional and is not needed to perform
801 an import.
802</p>
803</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59804<dt class="hdlist1">
Junio C Hamanoe52cf782007-08-19 19:15:52805<tt>progress</tt>
806</dt>
807<dd>
808<p>
809 Causes fast-import to echo the entire line to its own
810 standard output. This command is optional and is not needed
811 to perform an import.
812</p>
813</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59814<dt class="hdlist1">
Junio C Hamano6ce6b6c2010-01-18 01:25:50815<tt>feature</tt>
816</dt>
817<dd>
818<p>
819 Require that fast-import supports the specified feature, or
820 abort if it does not.
821</p>
822</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59823<dt class="hdlist1">
Junio C Hamano6ce6b6c2010-01-18 01:25:50824<tt>option</tt>
825</dt>
826<dd>
827<p>
828 Specify any of the options listed under OPTIONS that do not
Junio C Hamano68cf15a2010-11-06 01:01:59829 change stream semantic to suit the frontend&#8217;s needs. This
Junio C Hamano6ce6b6c2010-01-18 01:25:50830 command is optional and is not needed to perform an import.
831</p>
832</dd>
Junio C Hamanoba4b9282008-07-06 05:20:31833</dl></div>
834<h3 id="_tt_commit_tt"><tt>commit</tt></h3><div style="clear:left"></div>
Junio C Hamano68cf15a2010-11-06 01:01:59835<div class="paragraph"><p>Create or update a branch with a new commit, recording one logical
Junio C Hamanoba4b9282008-07-06 05:20:31836change to the project.</p></div>
Junio C Hamanodf60f442007-02-07 05:52:37837<div class="literalblock">
838<div class="content">
839<pre><tt> 'commit' SP &lt;ref&gt; LF
840 mark?
Junio C Hamano6d325df2010-01-01 00:02:47841 ('author' (SP &lt;name&gt;)? SP LT &lt;email&gt; GT SP &lt;when&gt; LF)?
842 'committer' (SP &lt;name&gt;)? SP LT &lt;email&gt; GT SP &lt;when&gt; LF
Junio C Hamanodf60f442007-02-07 05:52:37843 data
844 ('from' SP &lt;committish&gt; LF)?
845 ('merge' SP &lt;committish&gt; LF)?
Junio C Hamano3b70d3c2009-11-21 17:37:37846 (filemodify | filedelete | filecopy | filerename | filedeleteall | notemodify)*
Junio C Hamanoe52cf782007-08-19 19:15:52847 LF?</tt></pre>
Junio C Hamanodf60f442007-02-07 05:52:37848</div></div>
Junio C Hamano68cf15a2010-11-06 01:01:59849<div class="paragraph"><p>where <tt>&lt;ref&gt;</tt> is the name of the branch to make the commit on.
Junio C Hamanodf60f442007-02-07 05:52:37850Typically branch names are prefixed with <tt>refs/heads/</tt> in
851Git, so importing the CVS branch symbol <tt>RELENG-1_0</tt> would use
852<tt>refs/heads/RELENG-1_0</tt> for the value of <tt>&lt;ref&gt;</tt>. The value of
853<tt>&lt;ref&gt;</tt> must be a valid refname in Git. As <tt>LF</tt> is not valid in
Junio C Hamanoba4b9282008-07-06 05:20:31854a Git refname, no quoting or escaping syntax is supported here.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:59855<div class="paragraph"><p>A <tt>mark</tt> command may optionally appear, requesting fast-import to save a
Junio C Hamanodf60f442007-02-07 05:52:37856reference to the newly created commit for future use by the frontend
857(see below for format). It is very common for frontends to mark
858every commit they create, thereby allowing future branch creation
Junio C Hamanoba4b9282008-07-06 05:20:31859from any imported commit.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:59860<div class="paragraph"><p>The <tt>data</tt> command following <tt>committer</tt> must supply the commit
Junio C Hamanodf60f442007-02-07 05:52:37861message (see below for <tt>data</tt> command syntax). To import an empty
862commit message use a 0 length data. Commit messages are free-form
863and are not interpreted by Git. Currently they must be encoded in
Junio C Hamanoba4b9282008-07-06 05:20:31864UTF-8, as fast-import does not permit other encodings to be specified.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:59865<div class="paragraph"><p>Zero or more <tt>filemodify</tt>, <tt>filedelete</tt>, <tt>filecopy</tt>, <tt>filerename</tt>,
Junio C Hamano3b70d3c2009-11-21 17:37:37866<tt>filedeleteall</tt> and <tt>notemodify</tt> commands
Junio C Hamanodfc4ce72007-02-07 23:17:29867may be included to update the contents of the branch prior to
868creating the commit. These commands may be supplied in any order.
Junio C Hamanoa6387422007-08-25 03:54:27869However it is recommended that a <tt>filedeleteall</tt> command precede
Junio C Hamano3b70d3c2009-11-21 17:37:37870all <tt>filemodify</tt>, <tt>filecopy</tt>, <tt>filerename</tt> and <tt>notemodify</tt> commands in
871the same commit, as <tt>filedeleteall</tt> wipes the branch clean (see below).</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:59872<div class="paragraph"><p>The <tt>LF</tt> after the command is optional (it used to be required).</p></div>
Junio C Hamanoba4b9282008-07-06 05:20:31873<h4 id="_tt_author_tt"><tt>author</tt></h4>
Junio C Hamano68cf15a2010-11-06 01:01:59874<div class="paragraph"><p>An <tt>author</tt> command may optionally appear, if the author information
Junio C Hamanodf60f442007-02-07 05:52:37875might differ from the committer information. If <tt>author</tt> is omitted
Junio C Hamano68cf15a2010-11-06 01:01:59876then fast-import will automatically use the committer&#8217;s information for
Junio C Hamanodf60f442007-02-07 05:52:37877the author portion of the commit. See below for a description of
Junio C Hamanoba4b9282008-07-06 05:20:31878the fields in <tt>author</tt>, as they are identical to <tt>committer</tt>.</p></div>
879<h4 id="_tt_committer_tt"><tt>committer</tt></h4>
Junio C Hamano68cf15a2010-11-06 01:01:59880<div class="paragraph"><p>The <tt>committer</tt> command indicates who made this commit, and when
Junio C Hamanoba4b9282008-07-06 05:20:31881they made it.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:59882<div class="paragraph"><p>Here <tt>&lt;name&gt;</tt> is the person&#8217;s display name (for example
883&#8220;Com M Itter&#8221;) and <tt>&lt;email&gt;</tt> is the person&#8217;s email address
884(&#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)
Junio C Hamanodf60f442007-02-07 05:52:37885and greater-than (\x3e) symbols. These are required to delimit
886the email address from the other fields in the line. Note that
887<tt>&lt;name&gt;</tt> is free-form and may contain any sequence of bytes, except
Junio C Hamanoba4b9282008-07-06 05:20:31888<tt>LT</tt> and <tt>LF</tt>. It is typically UTF-8 encoded.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:59889<div class="paragraph"><p>The time of the change is specified by <tt>&lt;when&gt;</tt> using the date format
Junio C Hamanodfc4ce72007-02-07 23:17:29890that was selected by the --date-format=&lt;fmt&gt; command line option.
Junio C Hamanodf60f442007-02-07 05:52:37891See &#8220;Date Formats&#8221; above for the set of supported formats, and
Junio C Hamanoba4b9282008-07-06 05:20:31892their syntax.</p></div>
893<h4 id="_tt_from_tt"><tt>from</tt></h4>
Junio C Hamano68cf15a2010-11-06 01:01:59894<div class="paragraph"><p>The <tt>from</tt> command is used to specify the commit to initialize
Junio C Hamano5dad0832007-02-13 05:16:23895this branch from. This revision will be the first ancestor of the
Junio C Hamanoba4b9282008-07-06 05:20:31896new commit.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:59897<div class="paragraph"><p>Omitting the <tt>from</tt> command in the first commit of a new branch
Junio C Hamano5dad0832007-02-13 05:16:23898will cause fast-import to create that commit with no ancestor. This
899tends to be desired only for the initial commit of a project.
Junio C Hamano25c0b702008-03-23 09:41:37900If the frontend creates all files from scratch when making a new
901branch, a <tt>merge</tt> command may be used instead of <tt>from</tt> to start
902the commit with an empty tree.
Junio C Hamano5dad0832007-02-13 05:16:23903Omitting the <tt>from</tt> command on existing branches is usually desired,
904as the current commit on that branch is automatically assumed to
Junio C Hamanoba4b9282008-07-06 05:20:31905be the first ancestor of the new commit.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:59906<div class="paragraph"><p>As <tt>LF</tt> is not valid in a Git refname or SHA-1 expression, no
Junio C Hamanoba4b9282008-07-06 05:20:31907quoting or escaping syntax is supported within <tt>&lt;committish&gt;</tt>.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:59908<div class="paragraph"><p>Here <tt>&lt;committish&gt;</tt> is any of the following:</p></div>
909<div class="ulist"><ul>
Junio C Hamanodf60f442007-02-07 05:52:37910<li>
911<p>
Junio C Hamano68cf15a2010-11-06 01:01:59912The name of an existing branch already in fast-import&#8217;s internal branch
913 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:37914 expression.
915</p>
916</li>
917<li>
918<p>
919A mark reference, <tt>:&lt;idnum&gt;</tt>, where <tt>&lt;idnum&gt;</tt> is the mark number.
920</p>
Junio C Hamano68cf15a2010-11-06 01:01:59921<div class="paragraph"><p>The reason fast-import uses <tt>:</tt> to denote a mark reference is this character
Junio C Hamanodf60f442007-02-07 05:52:37922is not legal in a Git branch name. The leading <tt>:</tt> makes it easy
Junio C Hamanoa6387422007-08-25 03:54:27923to distinguish between the mark 42 (<tt>:42</tt>) and the branch 42 (<tt>42</tt>
Junio C Hamanodf60f442007-02-07 05:52:37924or <tt>refs/heads/42</tt>), or an abbreviated SHA-1 which happened to
Junio C Hamanoba4b9282008-07-06 05:20:31925consist only of base-10 digits.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:59926<div class="paragraph"><p>Marks must be declared (via <tt>mark</tt>) before they can be used.</p></div>
Junio C Hamanodf60f442007-02-07 05:52:37927</li>
928<li>
929<p>
930A complete 40 byte or abbreviated commit SHA-1 in hex.
931</p>
932</li>
933<li>
934<p>
935Any valid Git SHA-1 expression that resolves to a commit. See
Junio C Hamanoc27b7332010-10-14 04:37:28936 &#8220;SPECIFYING REVISIONS&#8221; in <a href="gitrevisions.html">gitrevisions(7)</a> for details.
Junio C Hamanodf60f442007-02-07 05:52:37937</p>
938</li>
Junio C Hamanoba4b9282008-07-06 05:20:31939</ul></div>
Junio C Hamano68cf15a2010-11-06 01:01:59940<div class="paragraph"><p>The special case of restarting an incremental import from the
Junio C Hamanoba4b9282008-07-06 05:20:31941current branch value should be written as:</p></div>
Junio C Hamanodf60f442007-02-07 05:52:37942<div class="listingblock">
943<div class="content">
944<pre><tt> from refs/heads/branch^0</tt></pre>
945</div></div>
Junio C Hamano68cf15a2010-11-06 01:01:59946<div class="paragraph"><p>The <tt>&#94;0</tt> suffix is necessary as fast-import does not permit a branch to
Junio C Hamanodf60f442007-02-07 05:52:37947start from itself, and the branch is created in memory before the
Junio C Hamano6926bef2007-06-16 09:54:05948<tt>from</tt> command is even read from the input. Adding <tt>&#94;0</tt> will force
Junio C Hamano68cf15a2010-11-06 01:01:59949fast-import to resolve the commit through Git&#8217;s revision parsing library,
Junio C Hamanodf60f442007-02-07 05:52:37950rather than its internal branch table, thereby loading in the
Junio C Hamanoba4b9282008-07-06 05:20:31951existing value of the branch.</p></div>
952<h4 id="_tt_merge_tt"><tt>merge</tt></h4>
Junio C Hamano68cf15a2010-11-06 01:01:59953<div class="paragraph"><p>Includes one additional ancestor commit. If the <tt>from</tt> command is
Junio C Hamano25c0b702008-03-23 09:41:37954omitted when creating a new branch, the first <tt>merge</tt> commit will be
955the first ancestor of the current commit, and the branch will start
956out with no files. An unlimited number of <tt>merge</tt> commands per
Junio C Hamanod3339982007-02-09 08:38:48957commit are permitted by fast-import, thereby establishing an n-way merge.
Junio C Hamano68cf15a2010-11-06 01:01:59958However Git&#8217;s other tools never create commits with more than 15
Junio C Hamanodf60f442007-02-07 05:52:37959additional ancestors (forming a 16-way merge). For this reason
960it is suggested that frontends do not use more than 15 <tt>merge</tt>
Junio C Hamanoba4b9282008-07-06 05:20:31961commands per commit; 16, if starting a new, empty branch.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:59962<div class="paragraph"><p>Here <tt>&lt;committish&gt;</tt> is any of the commit specification expressions
Junio C Hamanoba4b9282008-07-06 05:20:31963also accepted by <tt>from</tt> (see above).</p></div>
964<h4 id="_tt_filemodify_tt"><tt>filemodify</tt></h4>
Junio C Hamano68cf15a2010-11-06 01:01:59965<div class="paragraph"><p>Included in a <tt>commit</tt> command to add a new file or change the
Junio C Hamanodf60f442007-02-07 05:52:37966content of an existing file. This command has two different means
Junio C Hamanoba4b9282008-07-06 05:20:31967of specifying the content of the file.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:59968<div class="dlist"><dl>
969<dt class="hdlist1">
Junio C Hamanodf60f442007-02-07 05:52:37970External data format
971</dt>
972<dd>
973<p>
974 The data content for the file was already supplied by a prior
975 <tt>blob</tt> command. The frontend just needs to connect it.
976</p>
977<div class="literalblock">
978<div class="content">
979<pre><tt> 'M' SP &lt;mode&gt; SP &lt;dataref&gt; SP &lt;path&gt; LF</tt></pre>
980</div></div>
Junio C Hamano68cf15a2010-11-06 01:01:59981<div class="paragraph"><p>Here usually <tt>&lt;dataref&gt;</tt> must be either a mark reference (<tt>:&lt;idnum&gt;</tt>)
Junio C Hamanodf60f442007-02-07 05:52:37982set by a prior <tt>blob</tt> command, or a full 40-byte SHA-1 of an
Junio C Hamano619596a2010-08-18 22:15:35983existing Git blob object. If <tt>&lt;mode&gt;</tt> is <tt>040000</tt>` then
984<tt>&lt;dataref&gt;</tt> must be the full 40-byte SHA-1 of an existing
985Git tree object or a mark reference set with <tt>--import-marks</tt>.</p></div>
Junio C Hamanodf60f442007-02-07 05:52:37986</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59987<dt class="hdlist1">
Junio C Hamanodf60f442007-02-07 05:52:37988Inline data format
989</dt>
990<dd>
991<p>
992 The data content for the file has not been supplied yet.
993 The frontend wants to supply it as part of this modify
994 command.
995</p>
996<div class="literalblock">
997<div class="content">
998<pre><tt> 'M' SP &lt;mode&gt; SP 'inline' SP &lt;path&gt; LF
999 data</tt></pre>
1000</div></div>
Junio C Hamano68cf15a2010-11-06 01:01:591001<div class="paragraph"><p>See below for a detailed description of the <tt>data</tt> command.</p></div>
Junio C Hamanodf60f442007-02-07 05:52:371002</dd>
Junio C Hamanoba4b9282008-07-06 05:20:311003</dl></div>
Junio C Hamano68cf15a2010-11-06 01:01:591004<div class="paragraph"><p>In both formats <tt>&lt;mode&gt;</tt> is the type of file entry, specified
Junio C Hamanoba4b9282008-07-06 05:20:311005in octal. Git only supports the following modes:</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:591006<div class="ulist"><ul>
Junio C Hamanodf60f442007-02-07 05:52:371007<li>
1008<p>
1009<tt>100644</tt> or <tt>644</tt>: A normal (not-executable) file. The majority
1010 of files in most projects use this mode. If in doubt, this is
1011 what you want.
1012</p>
1013</li>
1014<li>
1015<p>
1016<tt>100755</tt> or <tt>755</tt>: A normal, but executable, file.
1017</p>
1018</li>
1019<li>
1020<p>
1021<tt>120000</tt>: A symlink, the content of the file will be the link target.
1022</p>
1023</li>
Junio C Hamano915cd9b2008-07-20 01:24:171024<li>
1025<p>
1026<tt>160000</tt>: A gitlink, SHA-1 of the object refers to a commit in
1027 another repository. Git links can only be specified by SHA or through
1028 a commit mark. They are used to implement submodules.
1029</p>
1030</li>
Junio C Hamano619596a2010-08-18 22:15:351031<li>
1032<p>
1033<tt>040000</tt>: A subdirectory. Subdirectories can only be specified by
1034 SHA or through a tree mark set with <tt>--import-marks</tt>.
1035</p>
1036</li>
Junio C Hamanoba4b9282008-07-06 05:20:311037</ul></div>
Junio C Hamano68cf15a2010-11-06 01:01:591038<div class="paragraph"><p>In both formats <tt>&lt;path&gt;</tt> is the complete path of the file to be added
Junio C Hamanoba4b9282008-07-06 05:20:311039(if not already existing) or modified (if already existing).</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:591040<div class="paragraph"><p>A <tt>&lt;path&gt;</tt> string must use UNIX-style directory separators (forward
Junio C Hamanodf60f442007-02-07 05:52:371041slash <tt>/</tt>), may contain any byte other than <tt>LF</tt>, and must not
Junio C Hamanoba4b9282008-07-06 05:20:311042start with double quote (<tt>"</tt>).</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:591043<div class="paragraph"><p>If an <tt>LF</tt> or double quote must be encoded into <tt>&lt;path&gt;</tt> shell-style
Junio C Hamanoba4b9282008-07-06 05:20:311044quoting should be used, e.g. <tt>"path/with\n and \" in it"</tt>.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:591045<div class="paragraph"><p>Additionally, in <tt>040000</tt> mode, <tt>&lt;path&gt;</tt> may also be an empty string
Junio C Hamanoc27b7332010-10-14 04:37:281046(<tt>""</tt>) to specify the root of the tree.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:591047<div class="paragraph"><p>The value of <tt>&lt;path&gt;</tt> must be in canonical form. That is it must not:</p></div>
1048<div class="ulist"><ul>
Junio C Hamanodf60f442007-02-07 05:52:371049<li>
1050<p>
1051contain an empty directory component (e.g. <tt>foo//bar</tt> is invalid),
1052</p>
1053</li>
1054<li>
1055<p>
Junio C Hamanoc51fede2007-03-12 07:29:201056end with a directory separator (e.g. <tt>foo/</tt> is invalid),
Junio C Hamanodf60f442007-02-07 05:52:371057</p>
1058</li>
1059<li>
1060<p>
Junio C Hamanoc51fede2007-03-12 07:29:201061start with a directory separator (e.g. <tt>/foo</tt> is invalid),
Junio C Hamanodf60f442007-02-07 05:52:371062</p>
1063</li>
1064<li>
1065<p>
1066contain the special component <tt>.</tt> or <tt>..</tt> (e.g. <tt>foo/./bar</tt> and
1067 <tt>foo/../bar</tt> are invalid).
1068</p>
1069</li>
Junio C Hamanoba4b9282008-07-06 05:20:311070</ul></div>
Junio C Hamano68cf15a2010-11-06 01:01:591071<div class="paragraph"><p>It is recommended that <tt>&lt;path&gt;</tt> always be encoded using UTF-8.</p></div>
Junio C Hamanoba4b9282008-07-06 05:20:311072<h4 id="_tt_filedelete_tt"><tt>filedelete</tt></h4>
Junio C Hamano68cf15a2010-11-06 01:01:591073<div class="paragraph"><p>Included in a <tt>commit</tt> command to remove a file or recursively
Junio C Hamano06216df2007-07-10 07:49:371074delete an entire directory from the branch. If the file or directory
1075removal makes its parent directory empty, the parent directory will
Junio C Hamanodf60f442007-02-07 05:52:371076be automatically removed too. This cascades up the tree until the
Junio C Hamanoba4b9282008-07-06 05:20:311077first non-empty directory or the root is reached.</p></div>
Junio C Hamanodf60f442007-02-07 05:52:371078<div class="literalblock">
1079<div class="content">
1080<pre><tt> 'D' SP &lt;path&gt; LF</tt></pre>
1081</div></div>
Junio C Hamano68cf15a2010-11-06 01:01:591082<div class="paragraph"><p>here <tt>&lt;path&gt;</tt> is the complete path of the file or subdirectory to
Junio C Hamano06216df2007-07-10 07:49:371083be removed from the branch.
Junio C Hamanoba4b9282008-07-06 05:20:311084See <tt>filemodify</tt> above for a detailed description of <tt>&lt;path&gt;</tt>.</p></div>
1085<h4 id="_tt_filecopy_tt"><tt>filecopy</tt></h4>
Junio C Hamano68cf15a2010-11-06 01:01:591086<div class="paragraph"><p>Recursively copies an existing file or subdirectory to a different
Junio C Hamanoc0ea7c62007-07-15 07:19:061087location within the branch. The existing file or directory must
1088exist. If the destination exists it will be completely replaced
Junio C Hamanoba4b9282008-07-06 05:20:311089by the content copied from the source.</p></div>
Junio C Hamanoc0ea7c62007-07-15 07:19:061090<div class="literalblock">
1091<div class="content">
1092<pre><tt> 'C' SP &lt;path&gt; SP &lt;path&gt; LF</tt></pre>
1093</div></div>
Junio C Hamano68cf15a2010-11-06 01:01:591094<div class="paragraph"><p>here the first <tt>&lt;path&gt;</tt> is the source location and the second
Junio C Hamanoc0ea7c62007-07-15 07:19:061095<tt>&lt;path&gt;</tt> is the destination. See <tt>filemodify</tt> above for a detailed
1096description of what <tt>&lt;path&gt;</tt> may look like. To use a source path
Junio C Hamanoba4b9282008-07-06 05:20:311097that contains SP the path must be quoted.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:591098<div class="paragraph"><p>A <tt>filecopy</tt> command takes effect immediately. Once the source
Junio C Hamanoc0ea7c62007-07-15 07:19:061099location has been copied to the destination any future commands
1100applied to the source location will not impact the destination of
Junio C Hamanoba4b9282008-07-06 05:20:311101the copy.</p></div>
1102<h4 id="_tt_filerename_tt"><tt>filerename</tt></h4>
Junio C Hamano68cf15a2010-11-06 01:01:591103<div class="paragraph"><p>Renames an existing file or subdirectory to a different location
Junio C Hamano06216df2007-07-10 07:49:371104within the branch. The existing file or directory must exist. If
Junio C Hamanoba4b9282008-07-06 05:20:311105the destination exists it will be replaced by the source directory.</p></div>
Junio C Hamano06216df2007-07-10 07:49:371106<div class="literalblock">
1107<div class="content">
1108<pre><tt> 'R' SP &lt;path&gt; SP &lt;path&gt; LF</tt></pre>
1109</div></div>
Junio C Hamano68cf15a2010-11-06 01:01:591110<div class="paragraph"><p>here the first <tt>&lt;path&gt;</tt> is the source location and the second
Junio C Hamano06216df2007-07-10 07:49:371111<tt>&lt;path&gt;</tt> is the destination. See <tt>filemodify</tt> above for a detailed
1112description of what <tt>&lt;path&gt;</tt> may look like. To use a source path
Junio C Hamanoba4b9282008-07-06 05:20:311113that contains SP the path must be quoted.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:591114<div class="paragraph"><p>A <tt>filerename</tt> command takes effect immediately. Once the source
Junio C Hamano06216df2007-07-10 07:49:371115location has been renamed to the destination any future commands
1116applied to the source location will create new files there and not
Junio C Hamanoba4b9282008-07-06 05:20:311117impact the destination of the rename.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:591118<div class="paragraph"><p>Note that a <tt>filerename</tt> is the same as a <tt>filecopy</tt> followed by a
Junio C Hamanoc0ea7c62007-07-15 07:19:061119<tt>filedelete</tt> of the source location. There is a slight performance
1120advantage to using <tt>filerename</tt>, but the advantage is so small
1121that it is never worth trying to convert a delete/add pair in
1122source material into a rename for fast-import. This <tt>filerename</tt>
1123command is provided just to simplify frontends that already have
Junio C Hamano68cf15a2010-11-06 01:01:591124rename information and don&#8217;t want bother with decomposing it into a
Junio C Hamanoba4b9282008-07-06 05:20:311125<tt>filecopy</tt> followed by a <tt>filedelete</tt>.</p></div>
1126<h4 id="_tt_filedeleteall_tt"><tt>filedeleteall</tt></h4>
Junio C Hamano68cf15a2010-11-06 01:01:591127<div class="paragraph"><p>Included in a <tt>commit</tt> command to remove all files (and also all
Junio C Hamanodfc4ce72007-02-07 23:17:291128directories) from the branch. This command resets the internal
1129branch structure to have no files in it, allowing the frontend
Junio C Hamanoba4b9282008-07-06 05:20:311130to subsequently add all interesting files from scratch.</p></div>
Junio C Hamanodfc4ce72007-02-07 23:17:291131<div class="literalblock">
1132<div class="content">
1133<pre><tt> 'deleteall' LF</tt></pre>
1134</div></div>
Junio C Hamano68cf15a2010-11-06 01:01:591135<div class="paragraph"><p>This command is extremely useful if the frontend does not know
Junio C Hamanodfc4ce72007-02-07 23:17:291136(or does not care to know) what files are currently on the branch,
1137and therefore cannot generate the proper <tt>filedelete</tt> commands to
Junio C Hamanoba4b9282008-07-06 05:20:311138update the content.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:591139<div class="paragraph"><p>Issuing a <tt>filedeleteall</tt> followed by the needed <tt>filemodify</tt>
Junio C Hamanodfc4ce72007-02-07 23:17:291140commands to set the correct content will produce the same results
1141as sending only the needed <tt>filemodify</tt> and <tt>filedelete</tt> commands.
Junio C Hamanod3339982007-02-09 08:38:481142The <tt>filedeleteall</tt> approach may however require fast-import to use slightly
Junio C Hamanodfc4ce72007-02-07 23:17:291143more memory per active branch (less than 1 MiB for even most large
1144projects); so frontends that can easily obtain only the affected
Junio C Hamanoba4b9282008-07-06 05:20:311145paths for a commit are encouraged to do so.</p></div>
Junio C Hamano3b70d3c2009-11-21 17:37:371146<h4 id="_tt_notemodify_tt"><tt>notemodify</tt></h4>
Junio C Hamano68cf15a2010-11-06 01:01:591147<div class="paragraph"><p>Included in a <tt>commit</tt> command to add a new note (annotating a given
Junio C Hamano3b70d3c2009-11-21 17:37:371148commit) or change the content of an existing note. This command has
1149two different means of specifying the content of the note.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:591150<div class="dlist"><dl>
1151<dt class="hdlist1">
Junio C Hamano3b70d3c2009-11-21 17:37:371152External data format
1153</dt>
1154<dd>
1155<p>
1156 The data content for the note was already supplied by a prior
1157 <tt>blob</tt> command. The frontend just needs to connect it to the
1158 commit that is to be annotated.
1159</p>
1160<div class="literalblock">
1161<div class="content">
1162<pre><tt> 'N' SP &lt;dataref&gt; SP &lt;committish&gt; LF</tt></pre>
1163</div></div>
Junio C Hamano68cf15a2010-11-06 01:01:591164<div class="paragraph"><p>Here <tt>&lt;dataref&gt;</tt> can be either a mark reference (<tt>:&lt;idnum&gt;</tt>)
Junio C Hamano3b70d3c2009-11-21 17:37:371165set by a prior <tt>blob</tt> command, or a full 40-byte SHA-1 of an
1166existing Git blob object.</p></div>
1167</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591168<dt class="hdlist1">
Junio C Hamano3b70d3c2009-11-21 17:37:371169Inline data format
1170</dt>
1171<dd>
1172<p>
1173 The data content for the note has not been supplied yet.
1174 The frontend wants to supply it as part of this modify
1175 command.
1176</p>
1177<div class="literalblock">
1178<div class="content">
1179<pre><tt> 'N' SP 'inline' SP &lt;committish&gt; LF
1180 data</tt></pre>
1181</div></div>
Junio C Hamano68cf15a2010-11-06 01:01:591182<div class="paragraph"><p>See below for a detailed description of the <tt>data</tt> command.</p></div>
Junio C Hamano3b70d3c2009-11-21 17:37:371183</dd>
1184</dl></div>
Junio C Hamano68cf15a2010-11-06 01:01:591185<div class="paragraph"><p>In both formats <tt>&lt;committish&gt;</tt> is any of the commit specification
Junio C Hamano3b70d3c2009-11-21 17:37:371186expressions also accepted by <tt>from</tt> (see above).</p></div>
Junio C Hamanoba4b9282008-07-06 05:20:311187<h3 id="_tt_mark_tt"><tt>mark</tt></h3><div style="clear:left"></div>
Junio C Hamano68cf15a2010-11-06 01:01:591188<div class="paragraph"><p>Arranges for fast-import to save a reference to the current object, allowing
Junio C Hamanodf60f442007-02-07 05:52:371189the frontend to recall this object at a future point in time, without
1190knowing its SHA-1. Here the current object is the object creation
1191command the <tt>mark</tt> command appears within. This can be <tt>commit</tt>,
Junio C Hamanoba4b9282008-07-06 05:20:311192<tt>tag</tt>, and <tt>blob</tt>, but <tt>commit</tt> is the most common usage.</p></div>
Junio C Hamanodf60f442007-02-07 05:52:371193<div class="literalblock">
1194<div class="content">
1195<pre><tt> 'mark' SP ':' &lt;idnum&gt; LF</tt></pre>
1196</div></div>
Junio C Hamano68cf15a2010-11-06 01:01:591197<div class="paragraph"><p>where <tt>&lt;idnum&gt;</tt> is the number assigned by the frontend to this mark.
Junio C Hamanodf60f442007-02-07 05:52:371198The value of <tt>&lt;idnum&gt;</tt> is expressed as an ASCII decimal integer.
1199The value 0 is reserved and cannot be used as
Junio C Hamanoba4b9282008-07-06 05:20:311200a mark. Only values greater than or equal to 1 may be used as marks.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:591201<div class="paragraph"><p>New marks are created automatically. Existing marks can be moved
Junio C Hamanodf60f442007-02-07 05:52:371202to another object simply by reusing the same <tt>&lt;idnum&gt;</tt> in another
Junio C Hamanoba4b9282008-07-06 05:20:311203<tt>mark</tt> command.</p></div>
1204<h3 id="_tt_tag_tt"><tt>tag</tt></h3><div style="clear:left"></div>
Junio C Hamano68cf15a2010-11-06 01:01:591205<div class="paragraph"><p>Creates an annotated tag referring to a specific commit. To create
Junio C Hamanoba4b9282008-07-06 05:20:311206lightweight (non-annotated) tags see the <tt>reset</tt> command below.</p></div>
Junio C Hamanodf60f442007-02-07 05:52:371207<div class="literalblock">
1208<div class="content">
1209<pre><tt> 'tag' SP &lt;name&gt; LF
1210 'from' SP &lt;committish&gt; LF
Junio C Hamano6d325df2010-01-01 00:02:471211 'tagger' (SP &lt;name&gt;)? SP LT &lt;email&gt; GT SP &lt;when&gt; LF
Junio C Hamanoea5dae62007-05-10 23:25:081212 data</tt></pre>
Junio C Hamanodf60f442007-02-07 05:52:371213</div></div>
Junio C Hamano68cf15a2010-11-06 01:01:591214<div class="paragraph"><p>where <tt>&lt;name&gt;</tt> is the name of the tag to create.</p></div>
1215<div class="paragraph"><p>Tag names are automatically prefixed with <tt>refs/tags/</tt> when stored
Junio C Hamanodf60f442007-02-07 05:52:371216in Git, so importing the CVS branch symbol <tt>RELENG-1_0-FINAL</tt> would
Junio C Hamanod3339982007-02-09 08:38:481217use just <tt>RELENG-1_0-FINAL</tt> for <tt>&lt;name&gt;</tt>, and fast-import will write the
Junio C Hamanoba4b9282008-07-06 05:20:311218corresponding ref as <tt>refs/tags/RELENG-1_0-FINAL</tt>.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:591219<div class="paragraph"><p>The value of <tt>&lt;name&gt;</tt> must be a valid refname in Git and therefore
Junio C Hamanodf60f442007-02-07 05:52:371220may contain forward slashes. As <tt>LF</tt> is not valid in a Git refname,
Junio C Hamanoba4b9282008-07-06 05:20:311221no quoting or escaping syntax is supported here.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:591222<div class="paragraph"><p>The <tt>from</tt> command is the same as in the <tt>commit</tt> command; see
Junio C Hamanoba4b9282008-07-06 05:20:311223above for details.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:591224<div class="paragraph"><p>The <tt>tagger</tt> command uses the same format as <tt>committer</tt> within
Junio C Hamanoba4b9282008-07-06 05:20:311225<tt>commit</tt>; again see above for details.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:591226<div class="paragraph"><p>The <tt>data</tt> command following <tt>tagger</tt> must supply the annotated tag
Junio C Hamanodf60f442007-02-07 05:52:371227message (see below for <tt>data</tt> command syntax). To import an empty
1228tag message use a 0 length data. Tag messages are free-form and are
1229not interpreted by Git. Currently they must be encoded in UTF-8,
Junio C Hamanoba4b9282008-07-06 05:20:311230as fast-import does not permit other encodings to be specified.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:591231<div class="paragraph"><p>Signing annotated tags during import from within fast-import is not
Junio C Hamanodf60f442007-02-07 05:52:371232supported. Trying to include your own PGP/GPG signature is not
1233recommended, as the frontend does not (easily) have access to the
1234complete set of bytes which normally goes into such a signature.
Junio C Hamanod3339982007-02-09 08:38:481235If signing is required, create lightweight tags from within fast-import with
Junio C Hamanodf60f442007-02-07 05:52:371236<tt>reset</tt>, then create the annotated versions of those tags offline
Junio C Hamano1aa40d22010-01-21 17:46:431237with the standard <em>git tag</em> process.</p></div>
Junio C Hamanoba4b9282008-07-06 05:20:311238<h3 id="_tt_reset_tt"><tt>reset</tt></h3><div style="clear:left"></div>
Junio C Hamano68cf15a2010-11-06 01:01:591239<div class="paragraph"><p>Creates (or recreates) the named branch, optionally starting from
Junio C Hamanodf60f442007-02-07 05:52:371240a specific revision. The reset command allows a frontend to issue
1241a new <tt>from</tt> command for an existing branch, or to create a new
Junio C Hamanoba4b9282008-07-06 05:20:311242branch from an existing commit without creating a new commit.</p></div>
Junio C Hamanodf60f442007-02-07 05:52:371243<div class="literalblock">
1244<div class="content">
1245<pre><tt> 'reset' SP &lt;ref&gt; LF
1246 ('from' SP &lt;committish&gt; LF)?
Junio C Hamanoe52cf782007-08-19 19:15:521247 LF?</tt></pre>
Junio C Hamanodf60f442007-02-07 05:52:371248</div></div>
Junio C Hamano68cf15a2010-11-06 01:01:591249<div class="paragraph"><p>For a detailed description of <tt>&lt;ref&gt;</tt> and <tt>&lt;committish&gt;</tt> see above
Junio C Hamanoba4b9282008-07-06 05:20:311250under <tt>commit</tt> and <tt>from</tt>.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:591251<div class="paragraph"><p>The <tt>LF</tt> after the command is optional (it used to be required).</p></div>
1252<div class="paragraph"><p>The <tt>reset</tt> command can also be used to create lightweight
Junio C Hamanoba4b9282008-07-06 05:20:311253(non-annotated) tags. For example:</p></div>
Junio C Hamanodf60f442007-02-07 05:52:371254<div class="exampleblock">
1255<div class="exampleblock-content">
1256<div class="literalblock">
1257<div class="content">
1258<pre><tt>reset refs/tags/938
1259from :938</tt></pre>
1260</div></div>
1261</div></div>
Junio C Hamano68cf15a2010-11-06 01:01:591262<div class="paragraph"><p>would create the lightweight tag <tt>refs/tags/938</tt> referring to
Junio C Hamanoba4b9282008-07-06 05:20:311263whatever commit mark <tt>:938</tt> references.</p></div>
1264<h3 id="_tt_blob_tt"><tt>blob</tt></h3><div style="clear:left"></div>
Junio C Hamano68cf15a2010-11-06 01:01:591265<div class="paragraph"><p>Requests writing one file revision to the packfile. The revision
Junio C Hamanodf60f442007-02-07 05:52:371266is not connected to any commit; this connection must be formed in
1267a subsequent <tt>commit</tt> command by referencing the blob through an
Junio C Hamanoba4b9282008-07-06 05:20:311268assigned mark.</p></div>
Junio C Hamanodf60f442007-02-07 05:52:371269<div class="literalblock">
1270<div class="content">
1271<pre><tt> 'blob' LF
1272 mark?
1273 data</tt></pre>
1274</div></div>
Junio C Hamano68cf15a2010-11-06 01:01:591275<div class="paragraph"><p>The mark command is optional here as some frontends have chosen
Junio C Hamanodf60f442007-02-07 05:52:371276to generate the Git SHA-1 for the blob on their own, and feed that
Junio C Hamano68cf15a2010-11-06 01:01:591277directly to <tt>commit</tt>. This is typically more work than it&#8217;s worth
Junio C Hamanoba4b9282008-07-06 05:20:311278however, as marks are inexpensive to store and easy to use.</p></div>
1279<h3 id="_tt_data_tt"><tt>data</tt></h3><div style="clear:left"></div>
Junio C Hamano68cf15a2010-11-06 01:01:591280<div class="paragraph"><p>Supplies raw data (for use as blob/file content, commit messages, or
Junio C Hamanod3339982007-02-09 08:38:481281annotated tag messages) to fast-import. Data can be supplied using an exact
Junio C Hamanodf60f442007-02-07 05:52:371282byte count or delimited with a terminating line. Real frontends
1283intended for production-quality conversions should always use the
1284exact byte count format, as it is more robust and performs better.
Junio C Hamanoba4b9282008-07-06 05:20:311285The delimited format is intended primarily for testing fast-import.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:591286<div class="paragraph"><p>Comment lines appearing within the <tt>&lt;raw&gt;</tt> part of <tt>data</tt> commands
Junio C Hamanoe52cf782007-08-19 19:15:521287are always taken to be part of the body of the data and are therefore
1288never ignored by fast-import. This makes it safe to import any
Junio C Hamanoba4b9282008-07-06 05:20:311289file/message content whose lines might start with <tt>#</tt>.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:591290<div class="dlist"><dl>
1291<dt class="hdlist1">
Junio C Hamanodf60f442007-02-07 05:52:371292Exact byte count format
1293</dt>
1294<dd>
1295<p>
1296 The frontend must specify the number of bytes of data.
1297</p>
1298<div class="literalblock">
1299<div class="content">
1300<pre><tt> 'data' SP &lt;count&gt; LF
Junio C Hamanoe52cf782007-08-19 19:15:521301 &lt;raw&gt; LF?</tt></pre>
Junio C Hamanodf60f442007-02-07 05:52:371302</div></div>
Junio C Hamano68cf15a2010-11-06 01:01:591303<div class="paragraph"><p>where <tt>&lt;count&gt;</tt> is the exact number of bytes appearing within
Junio C Hamanodf60f442007-02-07 05:52:371304<tt>&lt;raw&gt;</tt>. The value of <tt>&lt;count&gt;</tt> is expressed as an ASCII decimal
1305integer. The <tt>LF</tt> on either side of <tt>&lt;raw&gt;</tt> is not
Junio C Hamanoba4b9282008-07-06 05:20:311306included in <tt>&lt;count&gt;</tt> and will not be included in the imported data.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:591307<div class="paragraph"><p>The <tt>LF</tt> after <tt>&lt;raw&gt;</tt> is optional (it used to be required) but
Junio C Hamanoe52cf782007-08-19 19:15:521308recommended. Always including it makes debugging a fast-import
1309stream easier as the next command always starts in column 0
Junio C Hamanoba4b9282008-07-06 05:20:311310of the next line, even if <tt>&lt;raw&gt;</tt> did not end with an <tt>LF</tt>.</p></div>
Junio C Hamanodf60f442007-02-07 05:52:371311</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591312<dt class="hdlist1">
Junio C Hamanodf60f442007-02-07 05:52:371313Delimited format
1314</dt>
1315<dd>
1316<p>
1317 A delimiter string is used to mark the end of the data.
Junio C Hamanod3339982007-02-09 08:38:481318 fast-import will compute the length by searching for the delimiter.
Junio C Hamanoa6387422007-08-25 03:54:271319 This format is primarily useful for testing and is not
Junio C Hamanodf60f442007-02-07 05:52:371320 recommended for real data.
1321</p>
1322<div class="literalblock">
1323<div class="content">
1324<pre><tt> 'data' SP '&lt;&lt;' &lt;delim&gt; LF
1325 &lt;raw&gt; LF
Junio C Hamanoe52cf782007-08-19 19:15:521326 &lt;delim&gt; LF
1327 LF?</tt></pre>
Junio C Hamanodf60f442007-02-07 05:52:371328</div></div>
Junio C Hamano68cf15a2010-11-06 01:01:591329<div class="paragraph"><p>where <tt>&lt;delim&gt;</tt> is the chosen delimiter string. The string <tt>&lt;delim&gt;</tt>
Junio C Hamanodf60f442007-02-07 05:52:371330must not appear on a line by itself within <tt>&lt;raw&gt;</tt>, as otherwise
Junio C Hamanod3339982007-02-09 08:38:481331fast-import will think the data ends earlier than it really does. The <tt>LF</tt>
Junio C Hamanodf60f442007-02-07 05:52:371332immediately trailing <tt>&lt;raw&gt;</tt> is part of <tt>&lt;raw&gt;</tt>. This is one of
1333the limitations of the delimited format, it is impossible to supply
Junio C Hamanoba4b9282008-07-06 05:20:311334a data chunk which does not have an LF as its last byte.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:591335<div class="paragraph"><p>The <tt>LF</tt> after <tt>&lt;delim&gt; LF</tt> is optional (it used to be required).</p></div>
Junio C Hamanodf60f442007-02-07 05:52:371336</dd>
Junio C Hamanoba4b9282008-07-06 05:20:311337</dl></div>
1338<h3 id="_tt_checkpoint_tt"><tt>checkpoint</tt></h3><div style="clear:left"></div>
Junio C Hamano68cf15a2010-11-06 01:01:591339<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:311340save out all current branch refs, tags and marks.</p></div>
Junio C Hamanodf60f442007-02-07 05:52:371341<div class="literalblock">
1342<div class="content">
1343<pre><tt> 'checkpoint' LF
Junio C Hamanoe52cf782007-08-19 19:15:521344 LF?</tt></pre>
Junio C Hamanodf60f442007-02-07 05:52:371345</div></div>
Junio C Hamano68cf15a2010-11-06 01:01:591346<div class="paragraph"><p>Note that fast-import automatically switches packfiles when the current
Junio C Hamanodfc4ce72007-02-07 23:17:291347packfile reaches --max-pack-size, or 4 GiB, whichever limit is
Junio C Hamanod3339982007-02-09 08:38:481348smaller. During an automatic packfile switch fast-import does not update
Junio C Hamanoba4b9282008-07-06 05:20:311349the branch refs, tags or marks.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:591350<div class="paragraph"><p>As a <tt>checkpoint</tt> can require a significant amount of CPU time and
Junio C Hamanodfc4ce72007-02-07 23:17:291351disk IO (to compute the overall pack SHA-1 checksum, generate the
1352corresponding index file, and update the refs) it can easily take
Junio C Hamanoba4b9282008-07-06 05:20:311353several minutes for a single <tt>checkpoint</tt> command to complete.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:591354<div class="paragraph"><p>Frontends may choose to issue checkpoints during extremely large
Junio C Hamanodfc4ce72007-02-07 23:17:291355and long running imports, or when they need to allow another Git
1356process access to a branch. However given that a 30 GiB Subversion
Junio C Hamanod3339982007-02-09 08:38:481357repository can be loaded into Git through fast-import in about 3 hours,
Junio C Hamanoba4b9282008-07-06 05:20:311358explicit checkpointing may not be necessary.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:591359<div class="paragraph"><p>The <tt>LF</tt> after the command is optional (it used to be required).</p></div>
Junio C Hamanoba4b9282008-07-06 05:20:311360<h3 id="_tt_progress_tt"><tt>progress</tt></h3><div style="clear:left"></div>
Junio C Hamano68cf15a2010-11-06 01:01:591361<div class="paragraph"><p>Causes fast-import to print the entire <tt>progress</tt> line unmodified to
Junio C Hamanoe52cf782007-08-19 19:15:521362its standard output channel (file descriptor 1) when the command is
1363processed from the input stream. The command otherwise has no impact
Junio C Hamano68cf15a2010-11-06 01:01:591364on the current import, or on any of fast-import&#8217;s internal state.</p></div>
Junio C Hamanoe52cf782007-08-19 19:15:521365<div class="literalblock">
1366<div class="content">
1367<pre><tt> 'progress' SP &lt;any&gt; LF
1368 LF?</tt></pre>
1369</div></div>
Junio C Hamano68cf15a2010-11-06 01:01:591370<div class="paragraph"><p>The <tt>&lt;any&gt;</tt> part of the command may contain any sequence of bytes
Junio C Hamanoe52cf782007-08-19 19:15:521371that does not contain <tt>LF</tt>. The <tt>LF</tt> after the command is optional.
1372Callers may wish to process the output through a tool such as sed to
Junio C Hamanoba4b9282008-07-06 05:20:311373remove the leading part of the line, for example:</p></div>
Junio C Hamanoe52cf782007-08-19 19:15:521374<div class="exampleblock">
1375<div class="exampleblock-content">
1376<div class="literalblock">
1377<div class="content">
Junio C Hamanofce7c7e2008-07-02 03:06:381378<pre><tt>frontend | git fast-import | sed 's/^progress //'</tt></pre>
Junio C Hamanoe52cf782007-08-19 19:15:521379</div></div>
1380</div></div>
Junio C Hamano68cf15a2010-11-06 01:01:591381<div class="paragraph"><p>Placing a <tt>progress</tt> command immediately after a <tt>checkpoint</tt> will
Junio C Hamanoe52cf782007-08-19 19:15:521382inform the reader when the <tt>checkpoint</tt> has been completed and it
Junio C Hamanoba4b9282008-07-06 05:20:311383can safely access the refs that fast-import updated.</p></div>
Junio C Hamano6ce6b6c2010-01-18 01:25:501384<h3 id="_tt_feature_tt"><tt>feature</tt></h3><div style="clear:left"></div>
Junio C Hamano68cf15a2010-11-06 01:01:591385<div class="paragraph"><p>Require that fast-import supports the specified feature, or abort if
Junio C Hamano6ce6b6c2010-01-18 01:25:501386it does not.</p></div>
1387<div class="literalblock">
1388<div class="content">
1389<pre><tt> 'feature' SP &lt;feature&gt; LF</tt></pre>
1390</div></div>
Junio C Hamano68cf15a2010-11-06 01:01:591391<div class="paragraph"><p>The &lt;feature&gt; part of the command may be any string matching
Junio C Hamano6ce6b6c2010-01-18 01:25:501392^[a-zA-Z][a-zA-Z-]*$ and should be understood by fast-import.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:591393<div class="paragraph"><p>Feature work identical as their option counterparts with the
Junio C Hamano6ce6b6c2010-01-18 01:25:501394exception of the import-marks feature, see below.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:591395<div class="paragraph"><p>The following features are currently supported:</p></div>
1396<div class="ulist"><ul>
Junio C Hamano6ce6b6c2010-01-18 01:25:501397<li>
1398<p>
1399date-format
1400</p>
1401</li>
1402<li>
1403<p>
1404import-marks
1405</p>
1406</li>
1407<li>
1408<p>
1409export-marks
1410</p>
1411</li>
1412<li>
1413<p>
1414relative-marks
1415</p>
1416</li>
1417<li>
1418<p>
1419no-relative-marks
1420</p>
1421</li>
1422<li>
1423<p>
1424force
1425</p>
1426</li>
1427</ul></div>
Junio C Hamano68cf15a2010-11-06 01:01:591428<div class="paragraph"><p>The import-marks behaves differently from when it is specified as
Junio C Hamano6ce6b6c2010-01-18 01:25:501429commandline option in that only one "feature import-marks" is allowed
1430per stream. Also, any --import-marks= specified on the commandline
1431will override those from the stream (if any).</p></div>
1432<h3 id="_tt_option_tt"><tt>option</tt></h3><div style="clear:left"></div>
Junio C Hamano68cf15a2010-11-06 01:01:591433<div class="paragraph"><p>Processes the specified option so that git fast-import behaves in a
1434way that suits the frontend&#8217;s needs.
Junio C Hamano6ce6b6c2010-01-18 01:25:501435Note that options specified by the frontend are overridden by any
1436options the user may specify to git fast-import itself.</p></div>
1437<div class="literalblock">
1438<div class="content">
1439<pre><tt> 'option' SP &lt;option&gt; LF</tt></pre>
1440</div></div>
Junio C Hamano68cf15a2010-11-06 01:01:591441<div class="paragraph"><p>The <tt>&lt;option&gt;</tt> part of the command may contain any of the options
Junio C Hamano6ce6b6c2010-01-18 01:25:501442listed in the OPTIONS section that do not change import semantics,
1443without the leading <em>--</em> and is treated in the same way.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:591444<div class="paragraph"><p>Option commands must be the first commands on the input (not counting
Junio C Hamano6ce6b6c2010-01-18 01:25:501445feature commands), to give an option command after any non-option
1446command is an error.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:591447<div class="paragraph"><p>The following commandline options change import semantics and may therefore
Junio C Hamano6ce6b6c2010-01-18 01:25:501448not be passed as option:</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:591449<div class="ulist"><ul>
Junio C Hamano6ce6b6c2010-01-18 01:25:501450<li>
1451<p>
1452date-format
1453</p>
1454</li>
1455<li>
1456<p>
1457import-marks
1458</p>
1459</li>
1460<li>
1461<p>
1462export-marks
1463</p>
1464</li>
1465<li>
1466<p>
1467force
1468</p>
1469</li>
1470</ul></div>
Junio C Hamanodfc4ce72007-02-07 23:17:291471</div>
Junio C Hamanoba4b9282008-07-06 05:20:311472<h2 id="_crash_reports">Crash Reports</h2>
Junio C Hamano21391932008-02-16 10:02:541473<div class="sectionbody">
Junio C Hamano68cf15a2010-11-06 01:01:591474<div class="paragraph"><p>If fast-import is supplied invalid input it will terminate with a
Junio C Hamano21391932008-02-16 10:02:541475non-zero exit status and create a crash report in the top level of
1476the Git repository it was importing into. Crash reports contain
1477a snapshot of the internal fast-import state as well as the most
Junio C Hamanoba4b9282008-07-06 05:20:311478recent commands that lead up to the crash.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:591479<div class="paragraph"><p>All recent commands (including stream comments, file changes and
Junio C Hamano21391932008-02-16 10:02:541480progress commands) are shown in the command history within the crash
1481report, but raw file data and commit messages are excluded from the
1482crash report. This exclusion saves space within the report file
1483and reduces the amount of buffering that fast-import must perform
Junio C Hamanoba4b9282008-07-06 05:20:311484during execution.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:591485<div class="paragraph"><p>After writing a crash report fast-import will close the current
Junio C Hamano21391932008-02-16 10:02:541486packfile and export the marks table. This allows the frontend
1487developer to inspect the repository state and resume the import from
1488the point where it crashed. The modified branches and tags are not
1489updated during a crash, as the import did not complete successfully.
1490Branch and tag information can be found in the crash report and
Junio C Hamanoba4b9282008-07-06 05:20:311491must be applied manually if the update is needed.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:591492<div class="paragraph"><p>An example crash:</p></div>
Junio C Hamano21391932008-02-16 10:02:541493<div class="exampleblock">
1494<div class="exampleblock-content">
1495<div class="literalblock">
1496<div class="content">
1497<pre><tt>$ cat &gt;in &lt;&lt;END_OF_INPUT
1498# my very first test commit
1499commit refs/heads/master
1500committer Shawn O. Pearce &lt;spearce&gt; 19283 -0400
1501# who is that guy anyway?
1502data &lt;&lt;EOF
1503this is my commit
1504EOF
1505M 644 inline .gitignore
1506data &lt;&lt;EOF
1507.gitignore
1508EOF
1509M 777 inline bob
1510END_OF_INPUT</tt></pre>
1511</div></div>
1512<div class="literalblock">
1513<div class="content">
Junio C Hamanofce7c7e2008-07-02 03:06:381514<pre><tt>$ git fast-import &lt;in
Junio C Hamano21391932008-02-16 10:02:541515fatal: Corrupt mode: M 777 inline bob
1516fast-import: dumping crash report to .git/fast_import_crash_8434</tt></pre>
1517</div></div>
1518<div class="literalblock">
1519<div class="content">
1520<pre><tt>$ cat .git/fast_import_crash_8434
1521fast-import crash report:
1522 fast-import process: 8434
1523 parent process : 1391
1524 at Sat Sep 1 00:58:12 2007</tt></pre>
1525</div></div>
1526<div class="literalblock">
1527<div class="content">
1528<pre><tt>fatal: Corrupt mode: M 777 inline bob</tt></pre>
1529</div></div>
1530<div class="literalblock">
1531<div class="content">
1532<pre><tt>Most Recent Commands Before Crash
1533---------------------------------
1534 # my very first test commit
1535 commit refs/heads/master
1536 committer Shawn O. Pearce &lt;spearce&gt; 19283 -0400
1537 # who is that guy anyway?
1538 data &lt;&lt;EOF
1539 M 644 inline .gitignore
1540 data &lt;&lt;EOF
1541* M 777 inline bob</tt></pre>
1542</div></div>
1543<div class="literalblock">
1544<div class="content">
1545<pre><tt>Active Branch LRU
1546-----------------
1547 active_branches = 1 cur, 5 max</tt></pre>
1548</div></div>
1549<div class="literalblock">
1550<div class="content">
1551<pre><tt>pos clock name
1552~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1553 1) 0 refs/heads/master</tt></pre>
1554</div></div>
1555<div class="literalblock">
1556<div class="content">
1557<pre><tt>Inactive Branches
1558-----------------
1559refs/heads/master:
1560 status : active loaded dirty
1561 tip commit : 0000000000000000000000000000000000000000
1562 old tree : 0000000000000000000000000000000000000000
1563 cur tree : 0000000000000000000000000000000000000000
1564 commit clock: 0
1565 last pack :</tt></pre>
1566</div></div>
1567<div class="literalblock">
1568<div class="content">
1569<pre><tt>-------------------
1570END OF CRASH REPORT</tt></pre>
1571</div></div>
1572</div></div>
1573</div>
Junio C Hamanoba4b9282008-07-06 05:20:311574<h2 id="_tips_and_tricks">Tips and Tricks</h2>
Junio C Hamanodfc4ce72007-02-07 23:17:291575<div class="sectionbody">
Junio C Hamano68cf15a2010-11-06 01:01:591576<div class="paragraph"><p>The following tips and tricks have been collected from various
Junio C Hamanoba4b9282008-07-06 05:20:311577users of fast-import, and are offered here as suggestions.</p></div>
1578<h3 id="_use_one_mark_per_commit">Use One Mark Per Commit</h3><div style="clear:left"></div>
Junio C Hamano68cf15a2010-11-06 01:01:591579<div class="paragraph"><p>When doing a repository conversion, use a unique mark per commit
Junio C Hamanodfc4ce72007-02-07 23:17:291580(<tt>mark :&lt;n&gt;</tt>) and supply the --export-marks option on the command
Junio C Hamanod3339982007-02-09 08:38:481581line. fast-import will dump a file which lists every mark and the Git
Junio C Hamanodfc4ce72007-02-07 23:17:291582object SHA-1 that corresponds to it. If the frontend can tie
1583the marks back to the source repository, it is easy to verify the
1584accuracy and completeness of the import by comparing each Git
Junio C Hamanoba4b9282008-07-06 05:20:311585commit to the corresponding source revision.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:591586<div class="paragraph"><p>Coming from a system such as Perforce or Subversion this should be
Junio C Hamanod3339982007-02-09 08:38:481587quite simple, as the fast-import mark can also be the Perforce changeset
Junio C Hamanoba4b9282008-07-06 05:20:311588number or the Subversion revision number.</p></div>
1589<h3 id="_freely_skip_around_branches">Freely Skip Around Branches</h3><div style="clear:left"></div>
Junio C Hamano68cf15a2010-11-06 01:01:591590<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:291591at a time during an import. Although doing so might be slightly
Junio C Hamanod3339982007-02-09 08:38:481592faster for fast-import, it tends to increase the complexity of the frontend
Junio C Hamanoba4b9282008-07-06 05:20:311593code considerably.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:591594<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:291595cost of activating an inactive branch is so low that bouncing around
Junio C Hamanoba4b9282008-07-06 05:20:311596between branches has virtually no impact on import performance.</p></div>
1597<h3 id="_handling_renames">Handling Renames</h3><div style="clear:left"></div>
Junio C Hamano68cf15a2010-11-06 01:01:591598<div class="paragraph"><p>When importing a renamed file or directory, simply delete the old
Junio C Hamano9dd8bb02007-02-12 07:15:351599name(s) and modify the new name(s) during the corresponding commit.
1600Git performs rename detection after-the-fact, rather than explicitly
Junio C Hamanoba4b9282008-07-06 05:20:311601during a commit.</p></div>
1602<h3 id="_use_tag_fixup_branches">Use Tag Fixup Branches</h3><div style="clear:left"></div>
Junio C Hamano68cf15a2010-11-06 01:01:591603<div class="paragraph"><p>Some other SCM systems let the user create a tag from multiple
Junio C Hamanodfc4ce72007-02-07 23:17:291604files which are not from the same commit/changeset. Or to create
Junio C Hamanoba4b9282008-07-06 05:20:311605tags which are a subset of the files available in the repository.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:591606<div class="paragraph"><p>Importing these tags as-is in Git is impossible without making at
Junio C Hamanodfc4ce72007-02-07 23:17:291607least one commit which &#8220;fixes up&#8221; the files to match the content
Junio C Hamano68cf15a2010-11-06 01:01:591608of the tag. Use fast-import&#8217;s <tt>reset</tt> command to reset a dummy branch
Junio C Hamanodfc4ce72007-02-07 23:17:291609outside of your normal branch space to the base commit for the tag,
1610then commit one or more file fixup commits, and finally tag the
Junio C Hamanoba4b9282008-07-06 05:20:311611dummy branch.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:591612<div class="paragraph"><p>For example since all normal branches are stored under <tt>refs/heads/</tt>
Junio C Hamanodfc4ce72007-02-07 23:17:291613name the tag fixup branch <tt>TAG_FIXUP</tt>. This way it is impossible for
1614the fixup branch used by the importer to have namespace conflicts
1615with real branches imported from the source (the name <tt>TAG_FIXUP</tt>
Junio C Hamanoba4b9282008-07-06 05:20:311616is not <tt>refs/heads/TAG_FIXUP</tt>).</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:591617<div class="paragraph"><p>When committing fixups, consider using <tt>merge</tt> to connect the
Junio C Hamanodfc4ce72007-02-07 23:17:291618commit(s) which are supplying file revisions to the fixup branch.
Junio C Hamano1aa40d22010-01-21 17:46:431619Doing so will allow tools such as <em>git blame</em> to track
Junio C Hamanodfc4ce72007-02-07 23:17:291620through the real commit history and properly annotate the source
Junio C Hamanoba4b9282008-07-06 05:20:311621files.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:591622<div class="paragraph"><p>After fast-import terminates the frontend will need to do <tt>rm .git/TAG_FIXUP</tt>
Junio C Hamanoba4b9282008-07-06 05:20:311623to remove the dummy branch.</p></div>
1624<h3 id="_import_now_repack_later">Import Now, Repack Later</h3><div style="clear:left"></div>
Junio C Hamano68cf15a2010-11-06 01:01:591625<div class="paragraph"><p>As soon as fast-import completes the Git repository is completely valid
Junio C Hamanoa6387422007-08-25 03:54:271626and ready for use. Typically this takes only a very short time,
Junio C Hamanoba4b9282008-07-06 05:20:311627even for considerably large projects (100,000+ commits).</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:591628<div class="paragraph"><p>However repacking the repository is necessary to improve data
Junio C Hamanodfc4ce72007-02-07 23:17:291629locality and access performance. It can also take hours on extremely
1630large projects (especially if -f and a large --window parameter is
1631used). Since repacking is safe to run alongside readers and writers,
1632run the repack in the background and let it finish when it finishes.
Junio C Hamanoba4b9282008-07-06 05:20:311633There is no reason to wait to explore your new Git project!</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:591634<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:481635or performance tests until repacking is completed. fast-import outputs
Junio C Hamanodfc4ce72007-02-07 23:17:291636suboptimal packfiles that are simply never seen in real use
Junio C Hamanoba4b9282008-07-06 05:20:311637situations.</p></div>
1638<h3 id="_repacking_historical_data">Repacking Historical Data</h3><div style="clear:left"></div>
Junio C Hamano68cf15a2010-11-06 01:01:591639<div class="paragraph"><p>If you are repacking very old imported data (e.g. older than the
Junio C Hamanodfc4ce72007-02-07 23:17:291640last year), consider expending some extra CPU time and supplying
Junio C Hamano1aa40d22010-01-21 17:46:431641--window=50 (or higher) when you run <em>git repack</em>.
Junio C Hamanodfc4ce72007-02-07 23:17:291642This will take longer, but will also produce a smaller packfile.
1643You only need to expend the effort once, and everyone using your
Junio C Hamanoba4b9282008-07-06 05:20:311644project will benefit from the smaller repository.</p></div>
1645<h3 id="_include_some_progress_messages">Include Some Progress Messages</h3><div style="clear:left"></div>
Junio C Hamano68cf15a2010-11-06 01:01:591646<div class="paragraph"><p>Every once in a while have your frontend emit a <tt>progress</tt> message
Junio C Hamanoe52cf782007-08-19 19:15:521647to fast-import. The contents of the messages are entirely free-form,
1648so one suggestion would be to output the current month and year
1649each time the current commit date moves into the next month.
1650Your users will feel better knowing how much of the data stream
Junio C Hamanoba4b9282008-07-06 05:20:311651has been processed.</p></div>
Junio C Hamanodf60f442007-02-07 05:52:371652</div>
Junio C Hamanoba4b9282008-07-06 05:20:311653<h2 id="_packfile_optimization">Packfile Optimization</h2>
Junio C Hamanodf60f442007-02-07 05:52:371654<div class="sectionbody">
Junio C Hamano68cf15a2010-11-06 01:01:591655<div class="paragraph"><p>When packing a blob fast-import always attempts to deltify against the last
Junio C Hamanodf60f442007-02-07 05:52:371656blob written. Unless specifically arranged for by the frontend,
1657this will probably not be a prior version of the same file, so the
1658generated delta will not be the smallest possible. The resulting
Junio C Hamanoba4b9282008-07-06 05:20:311659packfile will be compressed, but will not be optimal.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:591660<div class="paragraph"><p>Frontends which have efficient access to all revisions of a
Junio C Hamanodf60f442007-02-07 05:52:371661single file (for example reading an RCS/CVS ,v file) can choose
1662to supply all revisions of that file as a sequence of consecutive
Junio C Hamanod3339982007-02-09 08:38:481663<tt>blob</tt> commands. This allows fast-import to deltify the different file
Junio C Hamanodf60f442007-02-07 05:52:371664revisions against each other, saving space in the final packfile.
1665Marks can be used to later identify individual file revisions during
Junio C Hamanoba4b9282008-07-06 05:20:311666a sequence of <tt>commit</tt> commands.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:591667<div class="paragraph"><p>The packfile(s) created by fast-import do not encourage good disk access
Junio C Hamanod3339982007-02-09 08:38:481668patterns. This is caused by fast-import writing the data in the order
Junio C Hamanodf60f442007-02-07 05:52:371669it is received on standard input, while Git typically organizes
1670data within packfiles to make the most recent (current tip) data
1671appear before historical data. Git also clusters commits together,
Junio C Hamanoba4b9282008-07-06 05:20:311672speeding up revision traversal through better cache locality.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:591673<div class="paragraph"><p>For this reason it is strongly recommended that users repack the
Junio C Hamanod3339982007-02-09 08:38:481674repository with <tt>git repack -a -d</tt> after fast-import completes, allowing
Junio C Hamanodf60f442007-02-07 05:52:371675Git to reorganize the packfiles for faster data access. If blob
1676deltas are suboptimal (see above) then also adding the <tt>-f</tt> option
1677to force recomputation of all deltas can significantly reduce the
Junio C Hamanoba4b9282008-07-06 05:20:311678final packfile size (30-50% smaller can be quite typical).</p></div>
Junio C Hamanodf60f442007-02-07 05:52:371679</div>
Junio C Hamanoba4b9282008-07-06 05:20:311680<h2 id="_memory_utilization">Memory Utilization</h2>
Junio C Hamanodf60f442007-02-07 05:52:371681<div class="sectionbody">
Junio C Hamano68cf15a2010-11-06 01:01:591682<div class="paragraph"><p>There are a number of factors which affect how much memory fast-import
Junio C Hamanodf60f442007-02-07 05:52:371683requires to perform an import. Like critical sections of core
Junio C Hamanoa6387422007-08-25 03:54:271684Git, fast-import uses its own memory allocators to amortize any overheads
1685associated with malloc. In practice fast-import tends to amortize any
Junio C Hamanoba4b9282008-07-06 05:20:311686malloc overheads to 0, due to its use of large block allocations.</p></div>
1687<h3 id="_per_object">per object</h3><div style="clear:left"></div>
Junio C Hamano68cf15a2010-11-06 01:01:591688<div class="paragraph"><p>fast-import maintains an in-memory structure for every object written in
Junio C Hamanodf60f442007-02-07 05:52:371689this execution. On a 32 bit system the structure is 32 bytes,
1690on a 64 bit system the structure is 40 bytes (due to the larger
1691pointer sizes). Objects in the table are not deallocated until
Junio C Hamanod3339982007-02-09 08:38:481692fast-import terminates. Importing 2 million objects on a 32 bit system
Junio C Hamanoba4b9282008-07-06 05:20:311693will require approximately 64 MiB of memory.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:591694<div class="paragraph"><p>The object table is actually a hashtable keyed on the object name
Junio C Hamanod3339982007-02-09 08:38:481695(the unique SHA-1). This storage configuration allows fast-import to reuse
Junio C Hamanodf60f442007-02-07 05:52:371696an existing or already written object and avoid writing duplicates
1697to the output packfile. Duplicate blobs are surprisingly common
Junio C Hamanoba4b9282008-07-06 05:20:311698in an import, typically due to branch merges in the source.</p></div>
1699<h3 id="_per_mark">per mark</h3><div style="clear:left"></div>
Junio C Hamano68cf15a2010-11-06 01:01:591700<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:371701bytes, depending on pointer size) per mark. Although the array
1702is sparse, frontends are still strongly encouraged to use marks
1703between 1 and n, where n is the total number of marks required for
Junio C Hamanoba4b9282008-07-06 05:20:311704this import.</p></div>
1705<h3 id="_per_branch">per branch</h3><div style="clear:left"></div>
Junio C Hamano68cf15a2010-11-06 01:01:591706<div class="paragraph"><p>Branches are classified as active and inactive. The memory usage
Junio C Hamanoba4b9282008-07-06 05:20:311707of the two classes is significantly different.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:591708<div class="paragraph"><p>Inactive branches are stored in a structure which uses 96 or 120
Junio C Hamanodf60f442007-02-07 05:52:371709bytes (32 bit or 64 bit systems, respectively), plus the length of
Junio C Hamanod3339982007-02-09 08:38:481710the branch name (typically under 200 bytes), per branch. fast-import will
Junio C Hamanodf60f442007-02-07 05:52:371711easily handle as many as 10,000 inactive branches in under 2 MiB
Junio C Hamanoba4b9282008-07-06 05:20:311712of memory.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:591713<div class="paragraph"><p>Active branches have the same overhead as inactive branches, but
Junio C Hamanodf60f442007-02-07 05:52:371714also contain copies of every tree that has been recently modified on
1715that branch. If subtree <tt>include</tt> has not been modified since the
1716branch became active, its contents will not be loaded into memory,
1717but if subtree <tt>src</tt> has been modified by a commit since the branch
Junio C Hamanoba4b9282008-07-06 05:20:311718became active, then its contents will be loaded in memory.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:591719<div class="paragraph"><p>As active branches store metadata about the files contained on that
Junio C Hamanodf60f442007-02-07 05:52:371720branch, their in-memory storage size can grow to a considerable size
Junio C Hamanoba4b9282008-07-06 05:20:311721(see below).</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:591722<div class="paragraph"><p>fast-import automatically moves active branches to inactive status based on
Junio C Hamanodf60f442007-02-07 05:52:371723a simple least-recently-used algorithm. The LRU chain is updated on
1724each <tt>commit</tt> command. The maximum number of active branches can be
Junio C Hamanoba4b9282008-07-06 05:20:311725increased or decreased on the command line with --active-branches=.</p></div>
1726<h3 id="_per_active_tree">per active tree</h3><div style="clear:left"></div>
Junio C Hamano68cf15a2010-11-06 01:01:591727<div class="paragraph"><p>Trees (aka directories) use just 12 bytes of memory on top of the
Junio C Hamanodf60f442007-02-07 05:52:371728memory required for their entries (see &#8220;per active file&#8221; below).
Junio C Hamanoa6387422007-08-25 03:54:271729The cost of a tree is virtually 0, as its overhead amortizes out
Junio C Hamanoba4b9282008-07-06 05:20:311730over the individual file entries.</p></div>
1731<h3 id="_per_active_file_entry">per active file entry</h3><div style="clear:left"></div>
Junio C Hamano68cf15a2010-11-06 01:01:591732<div class="paragraph"><p>Files (and pointers to subtrees) within active trees require 52 or 64
Junio C Hamanodf60f442007-02-07 05:52:371733bytes (32/64 bit platforms) per entry. To conserve space, file and
1734tree names are pooled in a common string table, allowing the filename
1735&#8220;Makefile&#8221; to use just 16 bytes (after including the string header
Junio C Hamanoba4b9282008-07-06 05:20:311736overhead) no matter how many times it occurs within the project.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:591737<div class="paragraph"><p>The active branch LRU, when coupled with the filename string pool
Junio C Hamanod3339982007-02-09 08:38:481738and lazy loading of subtrees, allows fast-import to efficiently import
Junio C Hamanodf60f442007-02-07 05:52:371739projects with 2,000+ branches and 45,114+ files in a very limited
Junio C Hamanoba4b9282008-07-06 05:20:311740memory footprint (less than 2.7 MiB per active branch).</p></div>
Junio C Hamanodf60f442007-02-07 05:52:371741</div>
Junio C Hamanoba4b9282008-07-06 05:20:311742<h2 id="_author">Author</h2>
Junio C Hamanodf60f442007-02-07 05:52:371743<div class="sectionbody">
Junio C Hamano68cf15a2010-11-06 01:01:591744<div class="paragraph"><p>Written by Shawn O. Pearce &lt;<a href="mailto:spearce@spearce.org">spearce@spearce.org</a>&gt;.</p></div>
Junio C Hamanodf60f442007-02-07 05:52:371745</div>
Junio C Hamanoba4b9282008-07-06 05:20:311746<h2 id="_documentation">Documentation</h2>
Junio C Hamanodf60f442007-02-07 05:52:371747<div class="sectionbody">
Junio C Hamano68cf15a2010-11-06 01:01:591748<div class="paragraph"><p>Documentation by Shawn O. Pearce &lt;<a href="mailto:spearce@spearce.org">spearce@spearce.org</a>&gt;.</p></div>
Junio C Hamanodf60f442007-02-07 05:52:371749</div>
Junio C Hamanoba4b9282008-07-06 05:20:311750<h2 id="_git">GIT</h2>
Junio C Hamanodf60f442007-02-07 05:52:371751<div class="sectionbody">
Junio C Hamano68cf15a2010-11-06 01:01:591752<div class="paragraph"><p>Part of the <a href="git.html">git(1)</a> suite</p></div>
Junio C Hamanodf60f442007-02-07 05:52:371753</div>
1754<div id="footer">
1755<div id="footer-text">
Junio C Hamano68cf15a2010-11-06 01:01:591756Last updated 2010-11-06 00:41:57 UTC
Junio C Hamanodf60f442007-02-07 05:52:371757</div>
1758</div>
1759</body>
1760</html>