Update git documentation
[TortoiseGit.git] / doc / source / en / TortoiseGit / git_doc / git-fast-import.xml
blob70d0b86e8e6f651b3cab1d613544aa3d2b510504
1 <?xml version="1.0" encoding="UTF-8"?>\r
2 <!DOCTYPE sect2 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">\r
3 \r
4 <sect2 lang="en" id="git-fast-import(1)">\r
5     <title>git-fast-import(1)</title>\r
6 <indexterm>\r
7 <primary>git-fast-import(1)</primary>\r
8 </indexterm>\r
9 <simplesect id="git-fast-import(1)__name">\r
10 <title>NAME</title>\r
11 <simpara>git-fast-import - Backend for fast Git data importers</simpara>\r
12 </simplesect>\r
13 <simplesect id="git-fast-import(1)__synopsis">\r
14 <title>SYNOPSIS</title>\r
15 <blockquote>\r
16 <literallayout>frontend | <emphasis>git fast-import</emphasis> [options]</literallayout>\r
17 </blockquote>\r
18 </simplesect>\r
19 <simplesect id="git-fast-import(1)__description">\r
20 <title>DESCRIPTION</title>\r
21 <simpara>This program is usually not what the end user wants to run directly.\r
22 Most end users want to use one of the existing frontend programs,\r
23 which parses a specific type of foreign source and feeds the contents\r
24 stored there to <emphasis>git fast-import</emphasis>.</simpara>\r
25 <simpara>fast-import reads a mixed command/data stream from standard input and\r
26 writes one or more packfiles directly into the current repository.\r
27 When EOF is received on standard input, fast import writes out\r
28 updated branch and tag refs, fully updating the current repository\r
29 with the newly imported data.</simpara>\r
30 <simpara>The fast-import backend itself can import into an empty repository (one that\r
31 has already been initialized by <emphasis>git init</emphasis>) or incrementally\r
32 update an existing populated repository.  Whether or not incremental\r
33 imports are supported from a particular foreign source depends on\r
34 the frontend program in use.</simpara>\r
35 </simplesect>\r
36 <simplesect id="git-fast-import(1)__options">\r
37 <title>OPTIONS</title>\r
38 <variablelist>\r
39 <varlistentry>\r
40 <term>\r
41 --force\r
42 </term>\r
43 <listitem>\r
44 <simpara>\r
45         Force updating modified existing branches, even if doing\r
46         so would cause commits to be lost (as the new commit does\r
47         not contain the old commit).\r
48 </simpara>\r
49 </listitem>\r
50 </varlistentry>\r
51 <varlistentry>\r
52 <term>\r
53 --quiet\r
54 </term>\r
55 <listitem>\r
56 <simpara>\r
57         Disable all non-fatal output, making fast-import silent when it\r
58         is successful.  This option disables the output shown by\r
59         --stats.\r
60 </simpara>\r
61 </listitem>\r
62 </varlistentry>\r
63 <varlistentry>\r
64 <term>\r
65 --stats\r
66 </term>\r
67 <listitem>\r
68 <simpara>\r
69         Display some basic statistics about the objects fast-import has\r
70         created, the packfiles they were stored into, and the\r
71         memory used by fast-import during this run.  Showing this output\r
72         is currently the default, but can be disabled with --quiet.\r
73 </simpara>\r
74 </listitem>\r
75 </varlistentry>\r
76 </variablelist>\r
77 <section id="git-fast-import(1)__options_for_frontends">\r
78 <title>Options for Frontends</title>\r
79 <variablelist>\r
80 <varlistentry>\r
81 <term>\r
82 --cat-blob-fd=&lt;fd&gt;\r
83 </term>\r
84 <listitem>\r
85 <simpara>\r
86         Write responses to <emphasis>get-mark</emphasis>, <emphasis>cat-blob</emphasis>, and <emphasis>ls</emphasis> queries to the\r
87         file descriptor &lt;fd&gt; instead of <emphasis>stdout</emphasis>.  Allows <emphasis>progress</emphasis>\r
88         output intended for the end-user to be separated from other\r
89         output.\r
90 </simpara>\r
91 </listitem>\r
92 </varlistentry>\r
93 <varlistentry>\r
94 <term>\r
95 --date-format=&lt;fmt&gt;\r
96 </term>\r
97 <listitem>\r
98 <simpara>\r
99         Specify the type of dates the frontend will supply to\r
100         fast-import within <emphasis>author</emphasis>, <emphasis>committer</emphasis> and <emphasis>tagger</emphasis> commands.\r
101         See Date Formats below for details about which formats\r
102         are supported, and their syntax.\r
103 </simpara>\r
104 </listitem>\r
105 </varlistentry>\r
106 <varlistentry>\r
107 <term>\r
108 --done\r
109 </term>\r
110 <listitem>\r
111 <simpara>\r
112         Terminate with error if there is no <emphasis>done</emphasis> command at the end of\r
113         the stream.  This option might be useful for detecting errors\r
114         that cause the frontend to terminate before it has started to\r
115         write a stream.\r
116 </simpara>\r
117 </listitem>\r
118 </varlistentry>\r
119 </variablelist>\r
120 </section>\r
121 <section id="git-fast-import(1)__locations_of_marks_files">\r
122 <title>Locations of Marks Files</title>\r
123 <variablelist>\r
124 <varlistentry>\r
125 <term>\r
126 --export-marks=&lt;file&gt;\r
127 </term>\r
128 <listitem>\r
129 <simpara>\r
130         Dumps the internal marks table to &lt;file&gt; when complete.\r
131         Marks are written one per line as <emphasis>:markid SHA-1</emphasis>.\r
132         Frontends can use this file to validate imports after they\r
133         have been completed, or to save the marks table across\r
134         incremental runs.  As &lt;file&gt; is only opened and truncated\r
135         at checkpoint (or completion) the same path can also be\r
136         safely given to --import-marks.\r
137 </simpara>\r
138 </listitem>\r
139 </varlistentry>\r
140 <varlistentry>\r
141 <term>\r
142 --import-marks=&lt;file&gt;\r
143 </term>\r
144 <listitem>\r
145 <simpara>\r
146         Before processing any input, load the marks specified in\r
147         &lt;file&gt;.  The input file must exist, must be readable, and\r
148         must use the same format as produced by --export-marks.\r
149         Multiple options may be supplied to import more than one\r
150         set of marks.  If a mark is defined to different values,\r
151         the last file wins.\r
152 </simpara>\r
153 </listitem>\r
154 </varlistentry>\r
155 <varlistentry>\r
156 <term>\r
157 --import-marks-if-exists=&lt;file&gt;\r
158 </term>\r
159 <listitem>\r
160 <simpara>\r
161         Like --import-marks but instead of erroring out, silently\r
162         skips the file if it does not exist.\r
163 </simpara>\r
164 </listitem>\r
165 </varlistentry>\r
166 <varlistentry>\r
167 <term>\r
168 --[no-]relative-marks\r
169 </term>\r
170 <listitem>\r
171 <simpara>\r
172         After specifying --relative-marks the paths specified\r
173         with --import-marks= and --export-marks= are relative\r
174         to an internal directory in the current repository.\r
175         In git-fast-import this means that the paths are relative\r
176         to the .git/info/fast-import directory. However, other\r
177         importers may use a different location.\r
178 </simpara>\r
179 <simpara>Relative and non-relative marks may be combined by interweaving\r
180 --(no-)-relative-marks with the --(import|export)-marks= options.</simpara>\r
181 </listitem>\r
182 </varlistentry>\r
183 </variablelist>\r
184 </section>\r
185 <section id="git-fast-import(1)__performance_and_compression_tuning">\r
186 <title>Performance and Compression Tuning</title>\r
187 <variablelist>\r
188 <varlistentry>\r
189 <term>\r
190 --active-branches=&lt;n&gt;\r
191 </term>\r
192 <listitem>\r
193 <simpara>\r
194         Maximum number of branches to maintain active at once.\r
195         See Memory Utilization below for details.  Default is 5.\r
196 </simpara>\r
197 </listitem>\r
198 </varlistentry>\r
199 <varlistentry>\r
200 <term>\r
201 --big-file-threshold=&lt;n&gt;\r
202 </term>\r
203 <listitem>\r
204 <simpara>\r
205         Maximum size of a blob that fast-import will attempt to\r
206         create a delta for, expressed in bytes.  The default is 512m\r
207         (512 MiB).  Some importers may wish to lower this on systems\r
208         with constrained memory.\r
209 </simpara>\r
210 </listitem>\r
211 </varlistentry>\r
212 <varlistentry>\r
213 <term>\r
214 --depth=&lt;n&gt;\r
215 </term>\r
216 <listitem>\r
217 <simpara>\r
218         Maximum delta depth, for blob and tree deltification.\r
219         Default is 10.\r
220 </simpara>\r
221 </listitem>\r
222 </varlistentry>\r
223 <varlistentry>\r
224 <term>\r
225 --export-pack-edges=&lt;file&gt;\r
226 </term>\r
227 <listitem>\r
228 <simpara>\r
229         After creating a packfile, print a line of data to\r
230         &lt;file&gt; listing the filename of the packfile and the last\r
231         commit on each branch that was written to that packfile.\r
232         This information may be useful after importing projects\r
233         whose total object set exceeds the 4 GiB packfile limit,\r
234         as these commits can be used as edge points during calls\r
235         to <emphasis>git pack-objects</emphasis>.\r
236 </simpara>\r
237 </listitem>\r
238 </varlistentry>\r
239 <varlistentry>\r
240 <term>\r
241 --max-pack-size=&lt;n&gt;\r
242 </term>\r
243 <listitem>\r
244 <simpara>\r
245         Maximum size of each output packfile.\r
246         The default is unlimited.\r
247 </simpara>\r
248 </listitem>\r
249 </varlistentry>\r
250 </variablelist>\r
251 </section>\r
252 </simplesect>\r
253 <simplesect id="git-fast-import(1)__performance">\r
254 <title>Performance</title>\r
255 <simpara>The design of fast-import allows it to import large projects in a minimum\r
256 amount of memory usage and processing time.  Assuming the frontend\r
257 is able to keep up with fast-import and feed it a constant stream of data,\r
258 import times for projects holding 10+ years of history and containing\r
259 100,000+ individual commits are generally completed in just 1-2\r
260 hours on quite modest (~$2,000 USD) hardware.</simpara>\r
261 <simpara>Most bottlenecks appear to be in foreign source data access (the\r
262 source just cannot extract revisions fast enough) or disk IO (fast-import\r
263 writes as fast as the disk will take the data).  Imports will run\r
264 faster if the source data is stored on a different drive than the\r
265 destination Git repository (due to less IO contention).</simpara>\r
266 </simplesect>\r
267 <simplesect id="git-fast-import(1)__development_cost">\r
268 <title>Development Cost</title>\r
269 <simpara>A typical frontend for fast-import tends to weigh in at approximately 200\r
270 lines of Perl/Python/Ruby code.  Most developers have been able to\r
271 create working importers in just a couple of hours, even though it\r
272 is their first exposure to fast-import, and sometimes even to Git.  This is\r
273 an ideal situation, given that most conversion tools are throw-away\r
274 (use once, and never look back).</simpara>\r
275 </simplesect>\r
276 <simplesect id="git-fast-import(1)__parallel_operation">\r
277 <title>Parallel Operation</title>\r
278 <simpara>Like <emphasis>git push</emphasis> or <emphasis>git fetch</emphasis>, imports handled by fast-import are safe to\r
279 run alongside parallel <emphasis>git repack -a -d</emphasis> or <emphasis>git gc</emphasis> invocations,\r
280 or any other Git operation (including <emphasis>git prune</emphasis>, as loose objects\r
281 are never used by fast-import).</simpara>\r
282 <simpara>fast-import does not lock the branch or tag refs it is actively importing.\r
283 After the import, during its ref update phase, fast-import tests each\r
284 existing branch ref to verify the update will be a fast-forward\r
285 update (the commit stored in the ref is contained in the new\r
286 history of the commit to be written).  If the update is not a\r
287 fast-forward update, fast-import will skip updating that ref and instead\r
288 prints a warning message.  fast-import will always attempt to update all\r
289 branch refs, and does not stop on the first failure.</simpara>\r
290 <simpara>Branch updates can be forced with --force, but it's recommended that\r
291 this only be used on an otherwise quiet repository.  Using --force\r
292 is not necessary for an initial import into an empty repository.</simpara>\r
293 </simplesect>\r
294 <simplesect id="git-fast-import(1)__technical_discussion">\r
295 <title>Technical Discussion</title>\r
296 <simpara>fast-import tracks a set of branches in memory.  Any branch can be created\r
297 or modified at any point during the import process by sending a\r
298 <emphasis>commit</emphasis> command on the input stream.  This design allows a frontend\r
299 program to process an unlimited number of branches simultaneously,\r
300 generating commits in the order they are available from the source\r
301 data.  It also simplifies the frontend programs considerably.</simpara>\r
302 <simpara>fast-import does not use or alter the current working directory, or any\r
303 file within it.  (It does however update the current Git repository,\r
304 as referenced by <emphasis>GIT_DIR</emphasis>.)  Therefore an import frontend may use\r
305 the working directory for its own purposes, such as extracting file\r
306 revisions from the foreign source.  This ignorance of the working\r
307 directory also allows fast-import to run very quickly, as it does not\r
308 need to perform any costly file update operations when switching\r
309 between branches.</simpara>\r
310 </simplesect>\r
311 <simplesect id="git-fast-import(1)__input_format">\r
312 <title>Input Format</title>\r
313 <simpara>With the exception of raw file data (which Git does not interpret)\r
314 the fast-import input format is text (ASCII) based.  This text based\r
315 format simplifies development and debugging of frontend programs,\r
316 especially when a higher level language such as Perl, Python or\r
317 Ruby is being used.</simpara>\r
318 <simpara>fast-import is very strict about its input.  Where we say SP below we mean\r
319 <emphasis role="strong">exactly</emphasis> one space.  Likewise LF means one (and only one) linefeed\r
320 and HT one (and only one) horizontal tab.\r
321 Supplying additional whitespace characters will cause unexpected\r
322 results, such as branch names or file names with leading or trailing\r
323 spaces in their name, or early termination of fast-import when it encounters\r
324 unexpected input.</simpara>\r
325 <section id="git-fast-import(1)__stream_comments">\r
326 <title>Stream Comments</title>\r
327 <simpara>To aid in debugging frontends fast-import ignores any line that\r
328 begins with <emphasis>#</emphasis> (ASCII pound/hash) up to and including the line\r
329 ending <emphasis>LF</emphasis>.  A comment line may contain any sequence of bytes\r
330 that does not contain an LF and therefore may be used to include\r
331 any detailed debugging information that might be specific to the\r
332 frontend and useful when inspecting a fast-import data stream.</simpara>\r
333 </section>\r
334 <section id="git-fast-import(1)__date_formats">\r
335 <title>Date Formats</title>\r
336 <simpara>The following date formats are supported.  A frontend should select\r
337 the format it will use for this import by passing the format name\r
338 in the --date-format=&lt;fmt&gt; command-line option.</simpara>\r
339 <variablelist>\r
340 <varlistentry>\r
341 <term>\r
342 <emphasis>raw</emphasis>\r
343 </term>\r
344 <listitem>\r
345 <simpara>\r
346         This is the Git native format and is <emphasis>&lt;time&gt; SP &lt;offutc&gt;</emphasis>.\r
347         It is also fast-import's default format, if --date-format was\r
348         not specified.\r
349 </simpara>\r
350 <simpara>The time of the event is specified by <emphasis>&lt;time&gt;</emphasis> as the number of\r
351 seconds since the UNIX epoch (midnight, Jan 1, 1970, UTC) and is\r
352 written as an ASCII decimal integer.</simpara>\r
353 <simpara>The local offset is specified by <emphasis>&lt;offutc&gt;</emphasis> as a positive or negative\r
354 offset from UTC.  For example EST (which is 5 hours behind UTC)\r
355 would be expressed in <emphasis>&lt;tz&gt;</emphasis> by -0500 while UTC is +0000.\r
356 The local offset does not affect <emphasis>&lt;time&gt;</emphasis>; it is used only as an\r
357 advisement to help formatting routines display the timestamp.</simpara>\r
358 <simpara>If the local offset is not available in the source material, use\r
359 +0000, or the most common local offset.  For example many\r
360 organizations have a CVS repository which has only ever been accessed\r
361 by users who are located in the same location and time zone.  In this\r
362 case a reasonable offset from UTC could be assumed.</simpara>\r
363 <simpara>Unlike the <emphasis>rfc2822</emphasis> format, this format is very strict.  Any\r
364 variation in formatting will cause fast-import to reject the value.</simpara>\r
365 </listitem>\r
366 </varlistentry>\r
367 <varlistentry>\r
368 <term>\r
369 <emphasis>rfc2822</emphasis>\r
370 </term>\r
371 <listitem>\r
372 <simpara>\r
373         This is the standard email format as described by RFC 2822.\r
374 </simpara>\r
375 <simpara>An example value is Tue Feb 6 11:22:18 2007 -0500.  The Git\r
376 parser is accurate, but a little on the lenient side.  It is the\r
377 same parser used by <emphasis>git am</emphasis> when applying patches\r
378 received from email.</simpara>\r
379 <simpara>Some malformed strings may be accepted as valid dates.  In some of\r
380 these cases Git will still be able to obtain the correct date from\r
381 the malformed string.  There are also some types of malformed\r
382 strings which Git will parse wrong, and yet consider valid.\r
383 Seriously malformed strings will be rejected.</simpara>\r
384 <simpara>Unlike the <emphasis>raw</emphasis> format above, the time zone/UTC offset information\r
385 contained in an RFC 2822 date string is used to adjust the date\r
386 value to UTC prior to storage.  Therefore it is important that\r
387 this information be as accurate as possible.</simpara>\r
388 <simpara>If the source material uses RFC 2822 style dates,\r
389 the frontend should let fast-import handle the parsing and conversion\r
390 (rather than attempting to do it itself) as the Git parser has\r
391 been well tested in the wild.</simpara>\r
392 <simpara>Frontends should prefer the <emphasis>raw</emphasis> format if the source material\r
393 already uses UNIX-epoch format, can be coaxed to give dates in that\r
394 format, or its format is easily convertible to it, as there is no\r
395 ambiguity in parsing.</simpara>\r
396 </listitem>\r
397 </varlistentry>\r
398 <varlistentry>\r
399 <term>\r
400 <emphasis>now</emphasis>\r
401 </term>\r
402 <listitem>\r
403 <simpara>\r
404         Always use the current time and time zone.  The literal\r
405         <emphasis>now</emphasis> must always be supplied for <emphasis>&lt;when&gt;</emphasis>.\r
406 </simpara>\r
407 <simpara>This is a toy format.  The current time and time zone of this system\r
408 is always copied into the identity string at the time it is being\r
409 created by fast-import.  There is no way to specify a different time or\r
410 time zone.</simpara>\r
411 <simpara>This particular format is supplied as it's short to implement and\r
412 may be useful to a process that wants to create a new commit\r
413 right now, without needing to use a working directory or\r
414 <emphasis>git update-index</emphasis>.</simpara>\r
415 <simpara>If separate <emphasis>author</emphasis> and <emphasis>committer</emphasis> commands are used in a <emphasis>commit</emphasis>\r
416 the timestamps may not match, as the system clock will be polled\r
417 twice (once for each command).  The only way to ensure that both\r
418 author and committer identity information has the same timestamp\r
419 is to omit <emphasis>author</emphasis> (thus copying from <emphasis>committer</emphasis>) or to use a\r
420 date format other than <emphasis>now</emphasis>.</simpara>\r
421 </listitem>\r
422 </varlistentry>\r
423 </variablelist>\r
424 </section>\r
425 <section id="git-fast-import(1)__commands">\r
426 <title>Commands</title>\r
427 <simpara>fast-import accepts several commands to update the current repository\r
428 and control the current import process.  More detailed discussion\r
429 (with examples) of each command follows later.</simpara>\r
430 <variablelist>\r
431 <varlistentry>\r
432 <term>\r
433 <emphasis>commit</emphasis>\r
434 </term>\r
435 <listitem>\r
436 <simpara>\r
437         Creates a new branch or updates an existing branch by\r
438         creating a new commit and updating the branch to point at\r
439         the newly created commit.\r
440 </simpara>\r
441 </listitem>\r
442 </varlistentry>\r
443 <varlistentry>\r
444 <term>\r
445 <emphasis>tag</emphasis>\r
446 </term>\r
447 <listitem>\r
448 <simpara>\r
449         Creates an annotated tag object from an existing commit or\r
450         branch.  Lightweight tags are not supported by this command,\r
451         as they are not recommended for recording meaningful points\r
452         in time.\r
453 </simpara>\r
454 </listitem>\r
455 </varlistentry>\r
456 <varlistentry>\r
457 <term>\r
458 <emphasis>reset</emphasis>\r
459 </term>\r
460 <listitem>\r
461 <simpara>\r
462         Reset an existing branch (or a new branch) to a specific\r
463         revision.  This command must be used to change a branch to\r
464         a specific revision without making a commit on it.\r
465 </simpara>\r
466 </listitem>\r
467 </varlistentry>\r
468 <varlistentry>\r
469 <term>\r
470 <emphasis>blob</emphasis>\r
471 </term>\r
472 <listitem>\r
473 <simpara>\r
474         Convert raw file data into a blob, for future use in a\r
475         <emphasis>commit</emphasis> command.  This command is optional and is not\r
476         needed to perform an import.\r
477 </simpara>\r
478 </listitem>\r
479 </varlistentry>\r
480 <varlistentry>\r
481 <term>\r
482 <emphasis>checkpoint</emphasis>\r
483 </term>\r
484 <listitem>\r
485 <simpara>\r
486         Forces fast-import to close the current packfile, generate its\r
487         unique SHA-1 checksum and index, and start a new packfile.\r
488         This command is optional and is not needed to perform\r
489         an import.\r
490 </simpara>\r
491 </listitem>\r
492 </varlistentry>\r
493 <varlistentry>\r
494 <term>\r
495 <emphasis>progress</emphasis>\r
496 </term>\r
497 <listitem>\r
498 <simpara>\r
499         Causes fast-import to echo the entire line to its own\r
500         standard output.  This command is optional and is not needed\r
501         to perform an import.\r
502 </simpara>\r
503 </listitem>\r
504 </varlistentry>\r
505 <varlistentry>\r
506 <term>\r
507 <emphasis>done</emphasis>\r
508 </term>\r
509 <listitem>\r
510 <simpara>\r
511         Marks the end of the stream. This command is optional\r
512         unless the <emphasis>done</emphasis> feature was requested using the\r
513         <emphasis>--done</emphasis> command-line option or <emphasis>feature done</emphasis> command.\r
514 </simpara>\r
515 </listitem>\r
516 </varlistentry>\r
517 <varlistentry>\r
518 <term>\r
519 <emphasis>get-mark</emphasis>\r
520 </term>\r
521 <listitem>\r
522 <simpara>\r
523         Causes fast-import to print the SHA-1 corresponding to a mark\r
524         to the file descriptor set with <emphasis>--cat-blob-fd</emphasis>, or <emphasis>stdout</emphasis> if\r
525         unspecified.\r
526 </simpara>\r
527 </listitem>\r
528 </varlistentry>\r
529 <varlistentry>\r
530 <term>\r
531 <emphasis>cat-blob</emphasis>\r
532 </term>\r
533 <listitem>\r
534 <simpara>\r
535         Causes fast-import to print a blob in <emphasis>cat-file --batch</emphasis>\r
536         format to the file descriptor set with <emphasis>--cat-blob-fd</emphasis> or\r
537         <emphasis>stdout</emphasis> if unspecified.\r
538 </simpara>\r
539 </listitem>\r
540 </varlistentry>\r
541 <varlistentry>\r
542 <term>\r
543 <emphasis>ls</emphasis>\r
544 </term>\r
545 <listitem>\r
546 <simpara>\r
547         Causes fast-import to print a line describing a directory\r
548         entry in <emphasis>ls-tree</emphasis> format to the file descriptor set with\r
549         <emphasis>--cat-blob-fd</emphasis> or <emphasis>stdout</emphasis> if unspecified.\r
550 </simpara>\r
551 </listitem>\r
552 </varlistentry>\r
553 <varlistentry>\r
554 <term>\r
555 <emphasis>feature</emphasis>\r
556 </term>\r
557 <listitem>\r
558 <simpara>\r
559         Enable the specified feature. This requires that fast-import\r
560         supports the specified feature, and aborts if it does not.\r
561 </simpara>\r
562 </listitem>\r
563 </varlistentry>\r
564 <varlistentry>\r
565 <term>\r
566 <emphasis>option</emphasis>\r
567 </term>\r
568 <listitem>\r
569 <simpara>\r
570         Specify any of the options listed under OPTIONS that do not\r
571         change stream semantic to suit the frontend's needs. This\r
572         command is optional and is not needed to perform an import.\r
573 </simpara>\r
574 </listitem>\r
575 </varlistentry>\r
576 </variablelist>\r
577 </section>\r
578 <section id="git-fast-import(1)__emphasis_commit_emphasis">\r
579 <title><emphasis>commit</emphasis></title>\r
580 <simpara>Create or update a branch with a new commit, recording one logical\r
581 change to the project.</simpara>\r
582 <literallayout class="monospaced">        'commit' SP &lt;ref&gt; LF\r
583         mark?\r
584         ('author' (SP &lt;name&gt;)? SP LT &lt;email&gt; GT SP &lt;when&gt; LF)?\r
585         'committer' (SP &lt;name&gt;)? SP LT &lt;email&gt; GT SP &lt;when&gt; LF\r
586         data\r
587         ('from' SP &lt;commit-ish&gt; LF)?\r
588         ('merge' SP &lt;commit-ish&gt; LF)?\r
589         (filemodify | filedelete | filecopy | filerename | filedeleteall | notemodify)*\r
590         LF?</literallayout>\r
591 <simpara>where <emphasis>&lt;ref&gt;</emphasis> is the name of the branch to make the commit on.\r
592 Typically branch names are prefixed with <emphasis>refs/heads/</emphasis> in\r
593 Git, so importing the CVS branch symbol <emphasis>RELENG-1_0</emphasis> would use\r
594 <emphasis>refs/heads/RELENG-1_0</emphasis> for the value of <emphasis>&lt;ref&gt;</emphasis>.  The value of\r
595 <emphasis>&lt;ref&gt;</emphasis> must be a valid refname in Git.  As <emphasis>LF</emphasis> is not valid in\r
596 a Git refname, no quoting or escaping syntax is supported here.</simpara>\r
597 <simpara>A <emphasis>mark</emphasis> command may optionally appear, requesting fast-import to save a\r
598 reference to the newly created commit for future use by the frontend\r
599 (see below for format).  It is very common for frontends to mark\r
600 every commit they create, thereby allowing future branch creation\r
601 from any imported commit.</simpara>\r
602 <simpara>The <emphasis>data</emphasis> command following <emphasis>committer</emphasis> must supply the commit\r
603 message (see below for <emphasis>data</emphasis> command syntax).  To import an empty\r
604 commit message use a 0 length data.  Commit messages are free-form\r
605 and are not interpreted by Git.  Currently they must be encoded in\r
606 UTF-8, as fast-import does not permit other encodings to be specified.</simpara>\r
607 <simpara>Zero or more <emphasis>filemodify</emphasis>, <emphasis>filedelete</emphasis>, <emphasis>filecopy</emphasis>, <emphasis>filerename</emphasis>,\r
608 <emphasis>filedeleteall</emphasis> and <emphasis>notemodify</emphasis> commands\r
609 may be included to update the contents of the branch prior to\r
610 creating the commit.  These commands may be supplied in any order.\r
611 However it is recommended that a <emphasis>filedeleteall</emphasis> command precede\r
612 all <emphasis>filemodify</emphasis>, <emphasis>filecopy</emphasis>, <emphasis>filerename</emphasis> and <emphasis>notemodify</emphasis> commands in\r
613 the same commit, as <emphasis>filedeleteall</emphasis> wipes the branch clean (see below).</simpara>\r
614 <simpara>The <emphasis>LF</emphasis> after the command is optional (it used to be required).</simpara>\r
615 <section id="git-fast-import(1)__emphasis_author_emphasis">\r
616 <title><emphasis>author</emphasis></title>\r
617 <simpara>An <emphasis>author</emphasis> command may optionally appear, if the author information\r
618 might differ from the committer information.  If <emphasis>author</emphasis> is omitted\r
619 then fast-import will automatically use the committer's information for\r
620 the author portion of the commit.  See below for a description of\r
621 the fields in <emphasis>author</emphasis>, as they are identical to <emphasis>committer</emphasis>.</simpara>\r
622 </section>\r
623 <section id="git-fast-import(1)__emphasis_committer_emphasis">\r
624 <title><emphasis>committer</emphasis></title>\r
625 <simpara>The <emphasis>committer</emphasis> command indicates who made this commit, and when\r
626 they made it.</simpara>\r
627 <simpara>Here <emphasis>&lt;name&gt;</emphasis> is the person's display name (for example\r
628 Com M Itter) and <emphasis>&lt;email&gt;</emphasis> is the person's email address\r
629 (cm@example.com).  <emphasis>LT</emphasis> and <emphasis>GT</emphasis> are the literal less-than (\x3c)\r
630 and greater-than (\x3e) symbols.  These are required to delimit\r
631 the email address from the other fields in the line.  Note that\r
632 <emphasis>&lt;name&gt;</emphasis> and <emphasis>&lt;email&gt;</emphasis> are free-form and may contain any sequence\r
633 of bytes, except <emphasis>LT</emphasis>, <emphasis>GT</emphasis> and <emphasis>LF</emphasis>.  <emphasis>&lt;name&gt;</emphasis> is typically UTF-8 encoded.</simpara>\r
634 <simpara>The time of the change is specified by <emphasis>&lt;when&gt;</emphasis> using the date format\r
635 that was selected by the --date-format=&lt;fmt&gt; command-line option.\r
636 See Date Formats above for the set of supported formats, and\r
637 their syntax.</simpara>\r
638 </section>\r
639 <section id="git-fast-import(1)__emphasis_from_emphasis">\r
640 <title><emphasis>from</emphasis></title>\r
641 <simpara>The <emphasis>from</emphasis> command is used to specify the commit to initialize\r
642 this branch from.  This revision will be the first ancestor of the\r
643 new commit.  The state of the tree built at this commit will begin\r
644 with the state at the <emphasis>from</emphasis> commit, and be altered by the content\r
645 modifications in this commit.</simpara>\r
646 <simpara>Omitting the <emphasis>from</emphasis> command in the first commit of a new branch\r
647 will cause fast-import to create that commit with no ancestor. This\r
648 tends to be desired only for the initial commit of a project.\r
649 If the frontend creates all files from scratch when making a new\r
650 branch, a <emphasis>merge</emphasis> command may be used instead of <emphasis>from</emphasis> to start\r
651 the commit with an empty tree.\r
652 Omitting the <emphasis>from</emphasis> command on existing branches is usually desired,\r
653 as the current commit on that branch is automatically assumed to\r
654 be the first ancestor of the new commit.</simpara>\r
655 <simpara>As <emphasis>LF</emphasis> is not valid in a Git refname or SHA-1 expression, no\r
656 quoting or escaping syntax is supported within <emphasis>&lt;commit-ish&gt;</emphasis>.</simpara>\r
657 <simpara>Here <emphasis>&lt;commit-ish&gt;</emphasis> is any of the following:</simpara>\r
658 <itemizedlist>\r
659 <listitem>\r
660 <simpara>\r
661 The name of an existing branch already in fast-import's internal branch\r
662   table.  If fast-import doesn't know the name, it's treated as a SHA-1\r
663   expression.\r
664 </simpara>\r
665 </listitem>\r
666 <listitem>\r
667 <simpara>\r
668 A mark reference, <emphasis>:&lt;idnum&gt;</emphasis>, where <emphasis>&lt;idnum&gt;</emphasis> is the mark number.\r
669 </simpara>\r
670 <simpara>The reason fast-import uses <emphasis>:</emphasis> to denote a mark reference is this character\r
671 is not legal in a Git branch name.  The leading <emphasis>:</emphasis> makes it easy\r
672 to distinguish between the mark 42 (<emphasis>:42</emphasis>) and the branch 42 (<emphasis>42</emphasis>\r
673 or <emphasis>refs/heads/42</emphasis>), or an abbreviated SHA-1 which happened to\r
674 consist only of base-10 digits.</simpara>\r
675 <simpara>Marks must be declared (via <emphasis>mark</emphasis>) before they can be used.</simpara>\r
676 </listitem>\r
677 <listitem>\r
678 <simpara>\r
679 A complete 40 byte or abbreviated commit SHA-1 in hex.\r
680 </simpara>\r
681 </listitem>\r
682 <listitem>\r
683 <simpara>\r
684 Any valid Git SHA-1 expression that resolves to a commit.  See\r
685   SPECIFYING REVISIONS in <xref linkend="gitrevisions(7)" /> for details.\r
686 </simpara>\r
687 </listitem>\r
688 <listitem>\r
689 <simpara>\r
690 The special null SHA-1 (40 zeros) specifies that the branch is to be\r
691   removed.\r
692 </simpara>\r
693 </listitem>\r
694 </itemizedlist>\r
695 <simpara>The special case of restarting an incremental import from the\r
696 current branch value should be written as:</simpara>\r
697 <screen>        from refs/heads/branch^0</screen>\r
698 <simpara>The <emphasis>^0</emphasis> suffix is necessary as fast-import does not permit a branch to\r
699 start from itself, and the branch is created in memory before the\r
700 <emphasis>from</emphasis> command is even read from the input.  Adding <emphasis>^0</emphasis> will force\r
701 fast-import to resolve the commit through Git's revision parsing library,\r
702 rather than its internal branch table, thereby loading in the\r
703 existing value of the branch.</simpara>\r
704 </section>\r
705 <section id="git-fast-import(1)__emphasis_merge_emphasis">\r
706 <title><emphasis>merge</emphasis></title>\r
707 <simpara>Includes one additional ancestor commit.  The additional ancestry\r
708 link does not change the way the tree state is built at this commit.\r
709 If the <emphasis>from</emphasis> command is\r
710 omitted when creating a new branch, the first <emphasis>merge</emphasis> commit will be\r
711 the first ancestor of the current commit, and the branch will start\r
712 out with no files.  An unlimited number of <emphasis>merge</emphasis> commands per\r
713 commit are permitted by fast-import, thereby establishing an n-way merge.</simpara>\r
714 <simpara>Here <emphasis>&lt;commit-ish&gt;</emphasis> is any of the commit specification expressions\r
715 also accepted by <emphasis>from</emphasis> (see above).</simpara>\r
716 </section>\r
717 <section id="git-fast-import(1)__emphasis_filemodify_emphasis">\r
718 <title><emphasis>filemodify</emphasis></title>\r
719 <simpara>Included in a <emphasis>commit</emphasis> command to add a new file or change the\r
720 content of an existing file.  This command has two different means\r
721 of specifying the content of the file.</simpara>\r
722 <variablelist>\r
723 <varlistentry>\r
724 <term>\r
725 External data format\r
726 </term>\r
727 <listitem>\r
728 <simpara>\r
729         The data content for the file was already supplied by a prior\r
730         <emphasis>blob</emphasis> command.  The frontend just needs to connect it.\r
731 </simpara>\r
732 <literallayout class="monospaced">        'M' SP &lt;mode&gt; SP &lt;dataref&gt; SP &lt;path&gt; LF</literallayout>\r
733 <simpara>Here usually <emphasis>&lt;dataref&gt;</emphasis> must be either a mark reference (<emphasis>:&lt;idnum&gt;</emphasis>)\r
734 set by a prior <emphasis>blob</emphasis> command, or a full 40-byte SHA-1 of an\r
735 existing Git blob object.  If <emphasis>&lt;mode&gt;</emphasis> is <emphasis>040000`</emphasis> then\r
736 <emphasis>&lt;dataref&gt;</emphasis> must be the full 40-byte SHA-1 of an existing\r
737 Git tree object or a mark reference set with <emphasis>--import-marks</emphasis>.</simpara>\r
738 </listitem>\r
739 </varlistentry>\r
740 <varlistentry>\r
741 <term>\r
742 Inline data format\r
743 </term>\r
744 <listitem>\r
745 <simpara>\r
746         The data content for the file has not been supplied yet.\r
747         The frontend wants to supply it as part of this modify\r
748         command.\r
749 </simpara>\r
750 <literallayout class="monospaced">        'M' SP &lt;mode&gt; SP 'inline' SP &lt;path&gt; LF\r
751         data</literallayout>\r
752 <simpara>See below for a detailed description of the <emphasis>data</emphasis> command.</simpara>\r
753 </listitem>\r
754 </varlistentry>\r
755 </variablelist>\r
756 <simpara>In both formats <emphasis>&lt;mode&gt;</emphasis> is the type of file entry, specified\r
757 in octal.  Git only supports the following modes:</simpara>\r
758 <itemizedlist>\r
759 <listitem>\r
760 <simpara>\r
761 <emphasis>100644</emphasis> or <emphasis>644</emphasis>: A normal (not-executable) file.  The majority\r
762   of files in most projects use this mode.  If in doubt, this is\r
763   what you want.\r
764 </simpara>\r
765 </listitem>\r
766 <listitem>\r
767 <simpara>\r
768 <emphasis>100755</emphasis> or <emphasis>755</emphasis>: A normal, but executable, file.\r
769 </simpara>\r
770 </listitem>\r
771 <listitem>\r
772 <simpara>\r
773 <emphasis>120000</emphasis>: A symlink, the content of the file will be the link target.\r
774 </simpara>\r
775 </listitem>\r
776 <listitem>\r
777 <simpara>\r
778 <emphasis>160000</emphasis>: A gitlink, SHA-1 of the object refers to a commit in\r
779   another repository. Git links can only be specified by SHA or through\r
780   a commit mark. They are used to implement submodules.\r
781 </simpara>\r
782 </listitem>\r
783 <listitem>\r
784 <simpara>\r
785 <emphasis>040000</emphasis>: A subdirectory.  Subdirectories can only be specified by\r
786   SHA or through a tree mark set with <emphasis>--import-marks</emphasis>.\r
787 </simpara>\r
788 </listitem>\r
789 </itemizedlist>\r
790 <simpara>In both formats <emphasis>&lt;path&gt;</emphasis> is the complete path of the file to be added\r
791 (if not already existing) or modified (if already existing).</simpara>\r
792 <simpara>A <emphasis>&lt;path&gt;</emphasis> string must use UNIX-style directory separators (forward\r
793 slash <emphasis>/</emphasis>), may contain any byte other than <emphasis>LF</emphasis>, and must not\r
794 start with double quote (<emphasis>"</emphasis>).</simpara>\r
795 <simpara>A path can use C-style string quoting; this is accepted in all cases\r
796 and mandatory if the filename starts with double quote or contains\r
797 <emphasis>LF</emphasis>. In C-style quoting, the complete name should be surrounded with\r
798 double quotes, and any <emphasis>LF</emphasis>, backslash, or double quote characters\r
799 must be escaped by preceding them with a backslash (e.g.,\r
800 <emphasis>"path/with\n, \\ and \" in it"</emphasis>).</simpara>\r
801 <simpara>The value of <emphasis>&lt;path&gt;</emphasis> must be in canonical form. That is it must not:</simpara>\r
802 <itemizedlist>\r
803 <listitem>\r
804 <simpara>\r
805 contain an empty directory component (e.g. <emphasis>foo//bar</emphasis> is invalid),\r
806 </simpara>\r
807 </listitem>\r
808 <listitem>\r
809 <simpara>\r
810 end with a directory separator (e.g. <emphasis>foo/</emphasis> is invalid),\r
811 </simpara>\r
812 </listitem>\r
813 <listitem>\r
814 <simpara>\r
815 start with a directory separator (e.g. <emphasis>/foo</emphasis> is invalid),\r
816 </simpara>\r
817 </listitem>\r
818 <listitem>\r
819 <simpara>\r
820 contain the special component <emphasis>.</emphasis> or <emphasis>..</emphasis> (e.g. <emphasis>foo/./bar</emphasis> and\r
821   <emphasis>foo/../bar</emphasis> are invalid).\r
822 </simpara>\r
823 </listitem>\r
824 </itemizedlist>\r
825 <simpara>The root of the tree can be represented by an empty string as <emphasis>&lt;path&gt;</emphasis>.</simpara>\r
826 <simpara>It is recommended that <emphasis>&lt;path&gt;</emphasis> always be encoded using UTF-8.</simpara>\r
827 </section>\r
828 <section id="git-fast-import(1)__emphasis_filedelete_emphasis">\r
829 <title><emphasis>filedelete</emphasis></title>\r
830 <simpara>Included in a <emphasis>commit</emphasis> command to remove a file or recursively\r
831 delete an entire directory from the branch.  If the file or directory\r
832 removal makes its parent directory empty, the parent directory will\r
833 be automatically removed too.  This cascades up the tree until the\r
834 first non-empty directory or the root is reached.</simpara>\r
835 <literallayout class="monospaced">        'D' SP &lt;path&gt; LF</literallayout>\r
836 <simpara>here <emphasis>&lt;path&gt;</emphasis> is the complete path of the file or subdirectory to\r
837 be removed from the branch.\r
838 See <emphasis>filemodify</emphasis> above for a detailed description of <emphasis>&lt;path&gt;</emphasis>.</simpara>\r
839 </section>\r
840 <section id="git-fast-import(1)__emphasis_filecopy_emphasis">\r
841 <title><emphasis>filecopy</emphasis></title>\r
842 <simpara>Recursively copies an existing file or subdirectory to a different\r
843 location within the branch.  The existing file or directory must\r
844 exist.  If the destination exists it will be completely replaced\r
845 by the content copied from the source.</simpara>\r
846 <literallayout class="monospaced">        'C' SP &lt;path&gt; SP &lt;path&gt; LF</literallayout>\r
847 <simpara>here the first <emphasis>&lt;path&gt;</emphasis> is the source location and the second\r
848 <emphasis>&lt;path&gt;</emphasis> is the destination.  See <emphasis>filemodify</emphasis> above for a detailed\r
849 description of what <emphasis>&lt;path&gt;</emphasis> may look like.  To use a source path\r
850 that contains SP the path must be quoted.</simpara>\r
851 <simpara>A <emphasis>filecopy</emphasis> command takes effect immediately.  Once the source\r
852 location has been copied to the destination any future commands\r
853 applied to the source location will not impact the destination of\r
854 the copy.</simpara>\r
855 </section>\r
856 <section id="git-fast-import(1)__emphasis_filerename_emphasis">\r
857 <title><emphasis>filerename</emphasis></title>\r
858 <simpara>Renames an existing file or subdirectory to a different location\r
859 within the branch.  The existing file or directory must exist. If\r
860 the destination exists it will be replaced by the source directory.</simpara>\r
861 <literallayout class="monospaced">        'R' SP &lt;path&gt; SP &lt;path&gt; LF</literallayout>\r
862 <simpara>here the first <emphasis>&lt;path&gt;</emphasis> is the source location and the second\r
863 <emphasis>&lt;path&gt;</emphasis> is the destination.  See <emphasis>filemodify</emphasis> above for a detailed\r
864 description of what <emphasis>&lt;path&gt;</emphasis> may look like.  To use a source path\r
865 that contains SP the path must be quoted.</simpara>\r
866 <simpara>A <emphasis>filerename</emphasis> command takes effect immediately.  Once the source\r
867 location has been renamed to the destination any future commands\r
868 applied to the source location will create new files there and not\r
869 impact the destination of the rename.</simpara>\r
870 <simpara>Note that a <emphasis>filerename</emphasis> is the same as a <emphasis>filecopy</emphasis> followed by a\r
871 <emphasis>filedelete</emphasis> of the source location.  There is a slight performance\r
872 advantage to using <emphasis>filerename</emphasis>, but the advantage is so small\r
873 that it is never worth trying to convert a delete/add pair in\r
874 source material into a rename for fast-import.  This <emphasis>filerename</emphasis>\r
875 command is provided just to simplify frontends that already have\r
876 rename information and don't want bother with decomposing it into a\r
877 <emphasis>filecopy</emphasis> followed by a <emphasis>filedelete</emphasis>.</simpara>\r
878 </section>\r
879 <section id="git-fast-import(1)__emphasis_filedeleteall_emphasis">\r
880 <title><emphasis>filedeleteall</emphasis></title>\r
881 <simpara>Included in a <emphasis>commit</emphasis> command to remove all files (and also all\r
882 directories) from the branch.  This command resets the internal\r
883 branch structure to have no files in it, allowing the frontend\r
884 to subsequently add all interesting files from scratch.</simpara>\r
885 <literallayout class="monospaced">        'deleteall' LF</literallayout>\r
886 <simpara>This command is extremely useful if the frontend does not know\r
887 (or does not care to know) what files are currently on the branch,\r
888 and therefore cannot generate the proper <emphasis>filedelete</emphasis> commands to\r
889 update the content.</simpara>\r
890 <simpara>Issuing a <emphasis>filedeleteall</emphasis> followed by the needed <emphasis>filemodify</emphasis>\r
891 commands to set the correct content will produce the same results\r
892 as sending only the needed <emphasis>filemodify</emphasis> and <emphasis>filedelete</emphasis> commands.\r
893 The <emphasis>filedeleteall</emphasis> approach may however require fast-import to use slightly\r
894 more memory per active branch (less than 1 MiB for even most large\r
895 projects); so frontends that can easily obtain only the affected\r
896 paths for a commit are encouraged to do so.</simpara>\r
897 </section>\r
898 <section id="git-fast-import(1)__emphasis_notemodify_emphasis">\r
899 <title><emphasis>notemodify</emphasis></title>\r
900 <simpara>Included in a <emphasis>commit</emphasis> <emphasis>&lt;notes_ref&gt;</emphasis> command to add a new note\r
901 annotating a <emphasis>&lt;commit-ish&gt;</emphasis> or change this annotation contents.\r
902 Internally it is similar to filemodify 100644 on <emphasis>&lt;commit-ish&gt;</emphasis>\r
903 path (maybe split into subdirectories). It's not advised to\r
904 use any other commands to write to the <emphasis>&lt;notes_ref&gt;</emphasis> tree except\r
905 <emphasis>filedeleteall</emphasis> to delete all existing notes in this tree.\r
906 This command has two different means of specifying the content\r
907 of the note.</simpara>\r
908 <variablelist>\r
909 <varlistentry>\r
910 <term>\r
911 External data format\r
912 </term>\r
913 <listitem>\r
914 <simpara>\r
915         The data content for the note was already supplied by a prior\r
916         <emphasis>blob</emphasis> command.  The frontend just needs to connect it to the\r
917         commit that is to be annotated.\r
918 </simpara>\r
919 <literallayout class="monospaced">        'N' SP &lt;dataref&gt; SP &lt;commit-ish&gt; LF</literallayout>\r
920 <simpara>Here <emphasis>&lt;dataref&gt;</emphasis> can be either a mark reference (<emphasis>:&lt;idnum&gt;</emphasis>)\r
921 set by a prior <emphasis>blob</emphasis> command, or a full 40-byte SHA-1 of an\r
922 existing Git blob object.</simpara>\r
923 </listitem>\r
924 </varlistentry>\r
925 <varlistentry>\r
926 <term>\r
927 Inline data format\r
928 </term>\r
929 <listitem>\r
930 <simpara>\r
931         The data content for the note has not been supplied yet.\r
932         The frontend wants to supply it as part of this modify\r
933         command.\r
934 </simpara>\r
935 <literallayout class="monospaced">        'N' SP 'inline' SP &lt;commit-ish&gt; LF\r
936         data</literallayout>\r
937 <simpara>See below for a detailed description of the <emphasis>data</emphasis> command.</simpara>\r
938 </listitem>\r
939 </varlistentry>\r
940 </variablelist>\r
941 <simpara>In both formats <emphasis>&lt;commit-ish&gt;</emphasis> is any of the commit specification\r
942 expressions also accepted by <emphasis>from</emphasis> (see above).</simpara>\r
943 </section>\r
944 </section>\r
945 <section id="git-fast-import(1)__emphasis_mark_emphasis">\r
946 <title><emphasis>mark</emphasis></title>\r
947 <simpara>Arranges for fast-import to save a reference to the current object, allowing\r
948 the frontend to recall this object at a future point in time, without\r
949 knowing its SHA-1.  Here the current object is the object creation\r
950 command the <emphasis>mark</emphasis> command appears within.  This can be <emphasis>commit</emphasis>,\r
951 <emphasis>tag</emphasis>, and <emphasis>blob</emphasis>, but <emphasis>commit</emphasis> is the most common usage.</simpara>\r
952 <literallayout class="monospaced">        'mark' SP ':' &lt;idnum&gt; LF</literallayout>\r
953 <simpara>where <emphasis>&lt;idnum&gt;</emphasis> is the number assigned by the frontend to this mark.\r
954 The value of <emphasis>&lt;idnum&gt;</emphasis> is expressed as an ASCII decimal integer.\r
955 The value 0 is reserved and cannot be used as\r
956 a mark.  Only values greater than or equal to 1 may be used as marks.</simpara>\r
957 <simpara>New marks are created automatically.  Existing marks can be moved\r
958 to another object simply by reusing the same <emphasis>&lt;idnum&gt;</emphasis> in another\r
959 <emphasis>mark</emphasis> command.</simpara>\r
960 </section>\r
961 <section id="git-fast-import(1)__emphasis_tag_emphasis">\r
962 <title><emphasis>tag</emphasis></title>\r
963 <simpara>Creates an annotated tag referring to a specific commit.  To create\r
964 lightweight (non-annotated) tags see the <emphasis>reset</emphasis> command below.</simpara>\r
965 <literallayout class="monospaced">        'tag' SP &lt;name&gt; LF\r
966         'from' SP &lt;commit-ish&gt; LF\r
967         'tagger' (SP &lt;name&gt;)? SP LT &lt;email&gt; GT SP &lt;when&gt; LF\r
968         data</literallayout>\r
969 <simpara>where <emphasis>&lt;name&gt;</emphasis> is the name of the tag to create.</simpara>\r
970 <simpara>Tag names are automatically prefixed with <emphasis>refs/tags/</emphasis> when stored\r
971 in Git, so importing the CVS branch symbol <emphasis>RELENG-1_0-FINAL</emphasis> would\r
972 use just <emphasis>RELENG-1_0-FINAL</emphasis> for <emphasis>&lt;name&gt;</emphasis>, and fast-import will write the\r
973 corresponding ref as <emphasis>refs/tags/RELENG-1_0-FINAL</emphasis>.</simpara>\r
974 <simpara>The value of <emphasis>&lt;name&gt;</emphasis> must be a valid refname in Git and therefore\r
975 may contain forward slashes.  As <emphasis>LF</emphasis> is not valid in a Git refname,\r
976 no quoting or escaping syntax is supported here.</simpara>\r
977 <simpara>The <emphasis>from</emphasis> command is the same as in the <emphasis>commit</emphasis> command; see\r
978 above for details.</simpara>\r
979 <simpara>The <emphasis>tagger</emphasis> command uses the same format as <emphasis>committer</emphasis> within\r
980 <emphasis>commit</emphasis>; again see above for details.</simpara>\r
981 <simpara>The <emphasis>data</emphasis> command following <emphasis>tagger</emphasis> must supply the annotated tag\r
982 message (see below for <emphasis>data</emphasis> command syntax).  To import an empty\r
983 tag message use a 0 length data.  Tag messages are free-form and are\r
984 not interpreted by Git.  Currently they must be encoded in UTF-8,\r
985 as fast-import does not permit other encodings to be specified.</simpara>\r
986 <simpara>Signing annotated tags during import from within fast-import is not\r
987 supported.  Trying to include your own PGP/GPG signature is not\r
988 recommended, as the frontend does not (easily) have access to the\r
989 complete set of bytes which normally goes into such a signature.\r
990 If signing is required, create lightweight tags from within fast-import with\r
991 <emphasis>reset</emphasis>, then create the annotated versions of those tags offline\r
992 with the standard <emphasis>git tag</emphasis> process.</simpara>\r
993 </section>\r
994 <section id="git-fast-import(1)__emphasis_reset_emphasis">\r
995 <title><emphasis>reset</emphasis></title>\r
996 <simpara>Creates (or recreates) the named branch, optionally starting from\r
997 a specific revision.  The reset command allows a frontend to issue\r
998 a new <emphasis>from</emphasis> command for an existing branch, or to create a new\r
999 branch from an existing commit without creating a new commit.</simpara>\r
1000 <literallayout class="monospaced">        'reset' SP &lt;ref&gt; LF\r
1001         ('from' SP &lt;commit-ish&gt; LF)?\r
1002         LF?</literallayout>\r
1003 <simpara>For a detailed description of <emphasis>&lt;ref&gt;</emphasis> and <emphasis>&lt;commit-ish&gt;</emphasis> see above\r
1004 under <emphasis>commit</emphasis> and <emphasis>from</emphasis>.</simpara>\r
1005 <simpara>The <emphasis>LF</emphasis> after the command is optional (it used to be required).</simpara>\r
1006 <simpara>The <emphasis>reset</emphasis> command can also be used to create lightweight\r
1007 (non-annotated) tags.  For example:</simpara>\r
1008 <informalexample>\r
1009 <literallayout class="monospaced">reset refs/tags/938\r
1010 from :938</literallayout>\r
1011 </informalexample>\r
1012 <simpara>would create the lightweight tag <emphasis>refs/tags/938</emphasis> referring to\r
1013 whatever commit mark <emphasis>:938</emphasis> references.</simpara>\r
1014 </section>\r
1015 <section id="git-fast-import(1)__emphasis_blob_emphasis">\r
1016 <title><emphasis>blob</emphasis></title>\r
1017 <simpara>Requests writing one file revision to the packfile.  The revision\r
1018 is not connected to any commit; this connection must be formed in\r
1019 a subsequent <emphasis>commit</emphasis> command by referencing the blob through an\r
1020 assigned mark.</simpara>\r
1021 <literallayout class="monospaced">        'blob' LF\r
1022         mark?\r
1023         data</literallayout>\r
1024 <simpara>The mark command is optional here as some frontends have chosen\r
1025 to generate the Git SHA-1 for the blob on their own, and feed that\r
1026 directly to <emphasis>commit</emphasis>.  This is typically more work than it's worth\r
1027 however, as marks are inexpensive to store and easy to use.</simpara>\r
1028 </section>\r
1029 <section id="git-fast-import(1)__emphasis_data_emphasis">\r
1030 <title><emphasis>data</emphasis></title>\r
1031 <simpara>Supplies raw data (for use as blob/file content, commit messages, or\r
1032 annotated tag messages) to fast-import.  Data can be supplied using an exact\r
1033 byte count or delimited with a terminating line.  Real frontends\r
1034 intended for production-quality conversions should always use the\r
1035 exact byte count format, as it is more robust and performs better.\r
1036 The delimited format is intended primarily for testing fast-import.</simpara>\r
1037 <simpara>Comment lines appearing within the <emphasis>&lt;raw&gt;</emphasis> part of <emphasis>data</emphasis> commands\r
1038 are always taken to be part of the body of the data and are therefore\r
1039 never ignored by fast-import.  This makes it safe to import any\r
1040 file/message content whose lines might start with <emphasis>#</emphasis>.</simpara>\r
1041 <variablelist>\r
1042 <varlistentry>\r
1043 <term>\r
1044 Exact byte count format\r
1045 </term>\r
1046 <listitem>\r
1047 <simpara>\r
1048         The frontend must specify the number of bytes of data.\r
1049 </simpara>\r
1050 <literallayout class="monospaced">        'data' SP &lt;count&gt; LF\r
1051         &lt;raw&gt; LF?</literallayout>\r
1052 <simpara>where <emphasis>&lt;count&gt;</emphasis> is the exact number of bytes appearing within\r
1053 <emphasis>&lt;raw&gt;</emphasis>.  The value of <emphasis>&lt;count&gt;</emphasis> is expressed as an ASCII decimal\r
1054 integer.  The <emphasis>LF</emphasis> on either side of <emphasis>&lt;raw&gt;</emphasis> is not\r
1055 included in <emphasis>&lt;count&gt;</emphasis> and will not be included in the imported data.</simpara>\r
1056 <simpara>The <emphasis>LF</emphasis> after <emphasis>&lt;raw&gt;</emphasis> is optional (it used to be required) but\r
1057 recommended.  Always including it makes debugging a fast-import\r
1058 stream easier as the next command always starts in column 0\r
1059 of the next line, even if <emphasis>&lt;raw&gt;</emphasis> did not end with an <emphasis>LF</emphasis>.</simpara>\r
1060 </listitem>\r
1061 </varlistentry>\r
1062 <varlistentry>\r
1063 <term>\r
1064 Delimited format\r
1065 </term>\r
1066 <listitem>\r
1067 <simpara>\r
1068         A delimiter string is used to mark the end of the data.\r
1069         fast-import will compute the length by searching for the delimiter.\r
1070         This format is primarily useful for testing and is not\r
1071         recommended for real data.\r
1072 </simpara>\r
1073 <literallayout class="monospaced">        'data' SP '&lt;&lt;' &lt;delim&gt; LF\r
1074         &lt;raw&gt; LF\r
1075         &lt;delim&gt; LF\r
1076         LF?</literallayout>\r
1077 <simpara>where <emphasis>&lt;delim&gt;</emphasis> is the chosen delimiter string.  The string <emphasis>&lt;delim&gt;</emphasis>\r
1078 must not appear on a line by itself within <emphasis>&lt;raw&gt;</emphasis>, as otherwise\r
1079 fast-import will think the data ends earlier than it really does.  The <emphasis>LF</emphasis>\r
1080 immediately trailing <emphasis>&lt;raw&gt;</emphasis> is part of <emphasis>&lt;raw&gt;</emphasis>.  This is one of\r
1081 the limitations of the delimited format, it is impossible to supply\r
1082 a data chunk which does not have an LF as its last byte.</simpara>\r
1083 <simpara>The <emphasis>LF</emphasis> after <emphasis>&lt;delim&gt; LF</emphasis> is optional (it used to be required).</simpara>\r
1084 </listitem>\r
1085 </varlistentry>\r
1086 </variablelist>\r
1087 </section>\r
1088 <section id="git-fast-import(1)__emphasis_checkpoint_emphasis">\r
1089 <title><emphasis>checkpoint</emphasis></title>\r
1090 <simpara>Forces fast-import to close the current packfile, start a new one, and to\r
1091 save out all current branch refs, tags and marks.</simpara>\r
1092 <literallayout class="monospaced">        'checkpoint' LF\r
1093         LF?</literallayout>\r
1094 <simpara>Note that fast-import automatically switches packfiles when the current\r
1095 packfile reaches --max-pack-size, or 4 GiB, whichever limit is\r
1096 smaller.  During an automatic packfile switch fast-import does not update\r
1097 the branch refs, tags or marks.</simpara>\r
1098 <simpara>As a <emphasis>checkpoint</emphasis> can require a significant amount of CPU time and\r
1099 disk IO (to compute the overall pack SHA-1 checksum, generate the\r
1100 corresponding index file, and update the refs) it can easily take\r
1101 several minutes for a single <emphasis>checkpoint</emphasis> command to complete.</simpara>\r
1102 <simpara>Frontends may choose to issue checkpoints during extremely large\r
1103 and long running imports, or when they need to allow another Git\r
1104 process access to a branch.  However given that a 30 GiB Subversion\r
1105 repository can be loaded into Git through fast-import in about 3 hours,\r
1106 explicit checkpointing may not be necessary.</simpara>\r
1107 <simpara>The <emphasis>LF</emphasis> after the command is optional (it used to be required).</simpara>\r
1108 </section>\r
1109 <section id="git-fast-import(1)__emphasis_progress_emphasis">\r
1110 <title><emphasis>progress</emphasis></title>\r
1111 <simpara>Causes fast-import to print the entire <emphasis>progress</emphasis> line unmodified to\r
1112 its standard output channel (file descriptor 1) when the command is\r
1113 processed from the input stream.  The command otherwise has no impact\r
1114 on the current import, or on any of fast-import's internal state.</simpara>\r
1115 <literallayout class="monospaced">        'progress' SP &lt;any&gt; LF\r
1116         LF?</literallayout>\r
1117 <simpara>The <emphasis>&lt;any&gt;</emphasis> part of the command may contain any sequence of bytes\r
1118 that does not contain <emphasis>LF</emphasis>.  The <emphasis>LF</emphasis> after the command is optional.\r
1119 Callers may wish to process the output through a tool such as sed to\r
1120 remove the leading part of the line, for example:</simpara>\r
1121 <informalexample>\r
1122 <literallayout class="monospaced">frontend | git fast-import | sed 's/^progress //'</literallayout>\r
1123 </informalexample>\r
1124 <simpara>Placing a <emphasis>progress</emphasis> command immediately after a <emphasis>checkpoint</emphasis> will\r
1125 inform the reader when the <emphasis>checkpoint</emphasis> has been completed and it\r
1126 can safely access the refs that fast-import updated.</simpara>\r
1127 </section>\r
1128 <section id="git-fast-import(1)__emphasis_get_mark_emphasis">\r
1129 <title><emphasis>get-mark</emphasis></title>\r
1130 <simpara>Causes fast-import to print the SHA-1 corresponding to a mark to\r
1131 stdout or to the file descriptor previously arranged with the\r
1132 <emphasis>--cat-blob-fd</emphasis> argument. The command otherwise has no impact on the\r
1133 current import; its purpose is to retrieve SHA-1s that later commits\r
1134 might want to refer to in their commit messages.</simpara>\r
1135 <literallayout class="monospaced">        'get-mark' SP ':' &lt;idnum&gt; LF</literallayout>\r
1136 <simpara>This command can be used anywhere in the stream that comments are\r
1137 accepted.  In particular, the <emphasis>get-mark</emphasis> command can be used in the\r
1138 middle of a commit but not in the middle of a <emphasis>data</emphasis> command.</simpara>\r
1139 <simpara>See Responses To Commands below for details about how to read\r
1140 this output safely.</simpara>\r
1141 </section>\r
1142 <section id="git-fast-import(1)__emphasis_cat_blob_emphasis">\r
1143 <title><emphasis>cat-blob</emphasis></title>\r
1144 <simpara>Causes fast-import to print a blob to a file descriptor previously\r
1145 arranged with the <emphasis>--cat-blob-fd</emphasis> argument.  The command otherwise\r
1146 has no impact on the current import; its main purpose is to\r
1147 retrieve blobs that may be in fast-import's memory but not\r
1148 accessible from the target repository.</simpara>\r
1149 <literallayout class="monospaced">        'cat-blob' SP &lt;dataref&gt; LF</literallayout>\r
1150 <simpara>The <emphasis>&lt;dataref&gt;</emphasis> can be either a mark reference (<emphasis>:&lt;idnum&gt;</emphasis>)\r
1151 set previously or a full 40-byte SHA-1 of a Git blob, preexisting or\r
1152 ready to be written.</simpara>\r
1153 <simpara>Output uses the same format as <emphasis>git cat-file --batch</emphasis>:</simpara>\r
1154 <informalexample>\r
1155 <literallayout class="monospaced">&lt;sha1&gt; SP 'blob' SP &lt;size&gt; LF\r
1156 &lt;contents&gt; LF</literallayout>\r
1157 </informalexample>\r
1158 <simpara>This command can be used anywhere in the stream that comments are\r
1159 accepted.  In particular, the <emphasis>cat-blob</emphasis> command can be used in the\r
1160 middle of a commit but not in the middle of a <emphasis>data</emphasis> command.</simpara>\r
1161 <simpara>See Responses To Commands below for details about how to read\r
1162 this output safely.</simpara>\r
1163 </section>\r
1164 <section id="git-fast-import(1)__emphasis_ls_emphasis">\r
1165 <title><emphasis>ls</emphasis></title>\r
1166 <simpara>Prints information about the object at a path to a file descriptor\r
1167 previously arranged with the <emphasis>--cat-blob-fd</emphasis> argument.  This allows\r
1168 printing a blob from the active commit (with <emphasis>cat-blob</emphasis>) or copying a\r
1169 blob or tree from a previous commit for use in the current one (with\r
1170 <emphasis>filemodify</emphasis>).</simpara>\r
1171 <simpara>The <emphasis>ls</emphasis> command can be used anywhere in the stream that comments are\r
1172 accepted, including the middle of a commit.</simpara>\r
1173 <variablelist>\r
1174 <varlistentry>\r
1175 <term>\r
1176 Reading from the active commit\r
1177 </term>\r
1178 <listitem>\r
1179 <simpara>\r
1180         This form can only be used in the middle of a <emphasis>commit</emphasis>.\r
1181         The path names a directory entry within fast-import's\r
1182         active commit.  The path must be quoted in this case.\r
1183 </simpara>\r
1184 <literallayout class="monospaced">        'ls' SP &lt;path&gt; LF</literallayout>\r
1185 </listitem>\r
1186 </varlistentry>\r
1187 <varlistentry>\r
1188 <term>\r
1189 Reading from a named tree\r
1190 </term>\r
1191 <listitem>\r
1192 <simpara>\r
1193         The <emphasis>&lt;dataref&gt;</emphasis> can be a mark reference (<emphasis>:&lt;idnum&gt;</emphasis>) or the\r
1194         full 40-byte SHA-1 of a Git tag, commit, or tree object,\r
1195         preexisting or waiting to be written.\r
1196         The path is relative to the top level of the tree\r
1197         named by <emphasis>&lt;dataref&gt;</emphasis>.\r
1198 </simpara>\r
1199 <literallayout class="monospaced">        'ls' SP &lt;dataref&gt; SP &lt;path&gt; LF</literallayout>\r
1200 </listitem>\r
1201 </varlistentry>\r
1202 </variablelist>\r
1203 <simpara>See <emphasis>filemodify</emphasis> above for a detailed description of <emphasis>&lt;path&gt;</emphasis>.</simpara>\r
1204 <simpara>Output uses the same format as <emphasis>git ls-tree &lt;tree&gt; -- &lt;path&gt;</emphasis>:</simpara>\r
1205 <informalexample>\r
1206 <literallayout class="monospaced">&lt;mode&gt; SP ('blob' | 'tree' | 'commit') SP &lt;dataref&gt; HT &lt;path&gt; LF</literallayout>\r
1207 </informalexample>\r
1208 <simpara>The &lt;dataref&gt; represents the blob, tree, or commit object at &lt;path&gt;\r
1209 and can be used in later <emphasis>get-mark</emphasis>, <emphasis>cat-blob</emphasis>, <emphasis>filemodify</emphasis>, or\r
1210 <emphasis>ls</emphasis> commands.</simpara>\r
1211 <simpara>If there is no file or subtree at that path, <emphasis>git fast-import</emphasis> will\r
1212 instead report</simpara>\r
1213 <informalexample>\r
1214 <literallayout class="monospaced">missing SP &lt;path&gt; LF</literallayout>\r
1215 </informalexample>\r
1216 <simpara>See Responses To Commands below for details about how to read\r
1217 this output safely.</simpara>\r
1218 </section>\r
1219 <section id="git-fast-import(1)__emphasis_feature_emphasis">\r
1220 <title><emphasis>feature</emphasis></title>\r
1221 <simpara>Require that fast-import supports the specified feature, or abort if\r
1222 it does not.</simpara>\r
1223 <literallayout class="monospaced">        'feature' SP &lt;feature&gt; ('=' &lt;argument&gt;)? LF</literallayout>\r
1224 <simpara>The &lt;feature&gt; part of the command may be any one of the following:</simpara>\r
1225 <variablelist>\r
1226 <varlistentry>\r
1227 <term>\r
1228 date-format\r
1229 </term>\r
1230 <term>\r
1231 export-marks\r
1232 </term>\r
1233 <term>\r
1234 relative-marks\r
1235 </term>\r
1236 <term>\r
1237 no-relative-marks\r
1238 </term>\r
1239 <term>\r
1240 force\r
1241 </term>\r
1242 <listitem>\r
1243 <simpara>\r
1244         Act as though the corresponding command-line option with\r
1245         a leading <emphasis>--</emphasis> was passed on the command line\r
1246         (see OPTIONS, above).\r
1247 </simpara>\r
1248 </listitem>\r
1249 </varlistentry>\r
1250 <varlistentry>\r
1251 <term>\r
1252 import-marks\r
1253 </term>\r
1254 <term>\r
1255 import-marks-if-exists\r
1256 </term>\r
1257 <listitem>\r
1258 <simpara>\r
1259         Like --import-marks except in two respects: first, only one\r
1260         "feature import-marks" or "feature import-marks-if-exists"\r
1261         command is allowed per stream; second, an --import-marks=\r
1262         or --import-marks-if-exists command-line option overrides\r
1263         any of these "feature" commands in the stream; third,\r
1264         "feature import-marks-if-exists" like a corresponding\r
1265         command-line option silently skips a nonexistent file.\r
1266 </simpara>\r
1267 </listitem>\r
1268 </varlistentry>\r
1269 <varlistentry>\r
1270 <term>\r
1271 get-mark\r
1272 </term>\r
1273 <term>\r
1274 cat-blob\r
1275 </term>\r
1276 <term>\r
1277 ls\r
1278 </term>\r
1279 <listitem>\r
1280 <simpara>\r
1281         Require that the backend support the <emphasis>get-mark</emphasis>, <emphasis>cat-blob</emphasis>,\r
1282         or <emphasis>ls</emphasis> command respectively.\r
1283         Versions of fast-import not supporting the specified command\r
1284         will exit with a message indicating so.\r
1285         This lets the import error out early with a clear message,\r
1286         rather than wasting time on the early part of an import\r
1287         before the unsupported command is detected.\r
1288 </simpara>\r
1289 </listitem>\r
1290 </varlistentry>\r
1291 <varlistentry>\r
1292 <term>\r
1293 notes\r
1294 </term>\r
1295 <listitem>\r
1296 <simpara>\r
1297         Require that the backend support the <emphasis>notemodify</emphasis> (N)\r
1298         subcommand to the <emphasis>commit</emphasis> command.\r
1299         Versions of fast-import not supporting notes will exit\r
1300         with a message indicating so.\r
1301 </simpara>\r
1302 </listitem>\r
1303 </varlistentry>\r
1304 <varlistentry>\r
1305 <term>\r
1306 done\r
1307 </term>\r
1308 <listitem>\r
1309 <simpara>\r
1310         Error out if the stream ends without a <emphasis>done</emphasis> command.\r
1311         Without this feature, errors causing the frontend to end\r
1312         abruptly at a convenient point in the stream can go\r
1313         undetected.  This may occur, for example, if an import\r
1314         front end dies in mid-operation without emitting SIGTERM\r
1315         or SIGKILL at its subordinate git fast-import instance.\r
1316 </simpara>\r
1317 </listitem>\r
1318 </varlistentry>\r
1319 </variablelist>\r
1320 </section>\r
1321 <section id="git-fast-import(1)__emphasis_option_emphasis">\r
1322 <title><emphasis>option</emphasis></title>\r
1323 <simpara>Processes the specified option so that git fast-import behaves in a\r
1324 way that suits the frontend's needs.\r
1325 Note that options specified by the frontend are overridden by any\r
1326 options the user may specify to git fast-import itself.</simpara>\r
1327 <literallayout class="monospaced">    'option' SP &lt;option&gt; LF</literallayout>\r
1328 <simpara>The <emphasis>&lt;option&gt;</emphasis> part of the command may contain any of the options\r
1329 listed in the OPTIONS section that do not change import semantics,\r
1330 without the leading <emphasis>--</emphasis> and is treated in the same way.</simpara>\r
1331 <simpara>Option commands must be the first commands on the input (not counting\r
1332 feature commands), to give an option command after any non-option\r
1333 command is an error.</simpara>\r
1334 <simpara>The following command-line options change import semantics and may therefore\r
1335 not be passed as option:</simpara>\r
1336 <itemizedlist>\r
1337 <listitem>\r
1338 <simpara>\r
1339 date-format\r
1340 </simpara>\r
1341 </listitem>\r
1342 <listitem>\r
1343 <simpara>\r
1344 import-marks\r
1345 </simpara>\r
1346 </listitem>\r
1347 <listitem>\r
1348 <simpara>\r
1349 export-marks\r
1350 </simpara>\r
1351 </listitem>\r
1352 <listitem>\r
1353 <simpara>\r
1354 cat-blob-fd\r
1355 </simpara>\r
1356 </listitem>\r
1357 <listitem>\r
1358 <simpara>\r
1359 force\r
1360 </simpara>\r
1361 </listitem>\r
1362 </itemizedlist>\r
1363 </section>\r
1364 <section id="git-fast-import(1)__emphasis_done_emphasis">\r
1365 <title><emphasis>done</emphasis></title>\r
1366 <simpara>If the <emphasis>done</emphasis> feature is not in use, treated as if EOF was read.\r
1367 This can be used to tell fast-import to finish early.</simpara>\r
1368 <simpara>If the <emphasis>--done</emphasis> command-line option or <emphasis>feature done</emphasis> command is\r
1369 in use, the <emphasis>done</emphasis> command is mandatory and marks the end of the\r
1370 stream.</simpara>\r
1371 </section>\r
1372 </simplesect>\r
1373 <simplesect id="git-fast-import(1)__responses_to_commands">\r
1374 <title>Responses To Commands</title>\r
1375 <simpara>New objects written by fast-import are not available immediately.\r
1376 Most fast-import commands have no visible effect until the next\r
1377 checkpoint (or completion).  The frontend can send commands to\r
1378 fill fast-import's input pipe without worrying about how quickly\r
1379 they will take effect, which improves performance by simplifying\r
1380 scheduling.</simpara>\r
1381 <simpara>For some frontends, though, it is useful to be able to read back\r
1382 data from the current repository as it is being updated (for\r
1383 example when the source material describes objects in terms of\r
1384 patches to be applied to previously imported objects).  This can\r
1385 be accomplished by connecting the frontend and fast-import via\r
1386 bidirectional pipes:</simpara>\r
1387 <informalexample>\r
1388 <literallayout class="monospaced">mkfifo fast-import-output\r
1389 frontend &lt;fast-import-output |\r
1390 git fast-import &gt;fast-import-output</literallayout>\r
1391 </informalexample>\r
1392 <simpara>A frontend set up this way can use <emphasis>progress</emphasis>, <emphasis>get-mark</emphasis>, <emphasis>ls</emphasis>, and\r
1393 <emphasis>cat-blob</emphasis> commands to read information from the import in progress.</simpara>\r
1394 <simpara>To avoid deadlock, such frontends must completely consume any\r
1395 pending output from <emphasis>progress</emphasis>, <emphasis>ls</emphasis>, <emphasis>get-mark</emphasis>, and <emphasis>cat-blob</emphasis> before\r
1396 performing writes to fast-import that might block.</simpara>\r
1397 </simplesect>\r
1398 <simplesect id="git-fast-import(1)__crash_reports">\r
1399 <title>Crash Reports</title>\r
1400 <simpara>If fast-import is supplied invalid input it will terminate with a\r
1401 non-zero exit status and create a crash report in the top level of\r
1402 the Git repository it was importing into.  Crash reports contain\r
1403 a snapshot of the internal fast-import state as well as the most\r
1404 recent commands that lead up to the crash.</simpara>\r
1405 <simpara>All recent commands (including stream comments, file changes and\r
1406 progress commands) are shown in the command history within the crash\r
1407 report, but raw file data and commit messages are excluded from the\r
1408 crash report.  This exclusion saves space within the report file\r
1409 and reduces the amount of buffering that fast-import must perform\r
1410 during execution.</simpara>\r
1411 <simpara>After writing a crash report fast-import will close the current\r
1412 packfile and export the marks table.  This allows the frontend\r
1413 developer to inspect the repository state and resume the import from\r
1414 the point where it crashed.  The modified branches and tags are not\r
1415 updated during a crash, as the import did not complete successfully.\r
1416 Branch and tag information can be found in the crash report and\r
1417 must be applied manually if the update is needed.</simpara>\r
1418 <simpara>An example crash:</simpara>\r
1419 <informalexample>\r
1420 <literallayout class="monospaced">$ cat &gt;in &lt;&lt;END_OF_INPUT\r
1421 # my very first test commit\r
1422 commit refs/heads/master\r
1423 committer Shawn O. Pearce &lt;spearce&gt; 19283 -0400\r
1424 # who is that guy anyway?\r
1425 data &lt;&lt;EOF\r
1426 this is my commit\r
1427 EOF\r
1428 M 644 inline .gitignore\r
1429 data &lt;&lt;EOF\r
1430 .gitignore\r
1431 EOF\r
1432 M 777 inline bob\r
1433 END_OF_INPUT</literallayout>\r
1434 <literallayout class="monospaced">$ git fast-import &lt;in\r
1435 fatal: Corrupt mode: M 777 inline bob\r
1436 fast-import: dumping crash report to .git/fast_import_crash_8434</literallayout>\r
1437 <literallayout class="monospaced">$ cat .git/fast_import_crash_8434\r
1438 fast-import crash report:\r
1439     fast-import process: 8434\r
1440     parent process     : 1391\r
1441     at Sat Sep 1 00:58:12 2007</literallayout>\r
1442 <literallayout class="monospaced">fatal: Corrupt mode: M 777 inline bob</literallayout>\r
1443 <literallayout class="monospaced">Most Recent Commands Before Crash\r
1444 ---------------------------------\r
1445   # my very first test commit\r
1446   commit refs/heads/master\r
1447   committer Shawn O. Pearce &lt;spearce&gt; 19283 -0400\r
1448   # who is that guy anyway?\r
1449   data &lt;&lt;EOF\r
1450   M 644 inline .gitignore\r
1451   data &lt;&lt;EOF\r
1452 * M 777 inline bob</literallayout>\r
1453 <literallayout class="monospaced">Active Branch LRU\r
1454 -----------------\r
1455     active_branches = 1 cur, 5 max</literallayout>\r
1456 <literallayout class="monospaced">pos  clock name\r
1457 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r
1458  1)      0 refs/heads/master</literallayout>\r
1459 <literallayout class="monospaced">Inactive Branches\r
1460 -----------------\r
1461 refs/heads/master:\r
1462   status      : active loaded dirty\r
1463   tip commit  : 0000000000000000000000000000000000000000\r
1464   old tree    : 0000000000000000000000000000000000000000\r
1465   cur tree    : 0000000000000000000000000000000000000000\r
1466   commit clock: 0\r
1467   last pack   :</literallayout>\r
1468 <literallayout class="monospaced">-------------------\r
1469 END OF CRASH REPORT</literallayout>\r
1470 </informalexample>\r
1471 </simplesect>\r
1472 <simplesect id="git-fast-import(1)__tips_and_tricks">\r
1473 <title>Tips and Tricks</title>\r
1474 <simpara>The following tips and tricks have been collected from various\r
1475 users of fast-import, and are offered here as suggestions.</simpara>\r
1476 <section id="git-fast-import(1)__use_one_mark_per_commit">\r
1477 <title>Use One Mark Per Commit</title>\r
1478 <simpara>When doing a repository conversion, use a unique mark per commit\r
1479 (<emphasis>mark :&lt;n&gt;</emphasis>) and supply the --export-marks option on the command\r
1480 line.  fast-import will dump a file which lists every mark and the Git\r
1481 object SHA-1 that corresponds to it.  If the frontend can tie\r
1482 the marks back to the source repository, it is easy to verify the\r
1483 accuracy and completeness of the import by comparing each Git\r
1484 commit to the corresponding source revision.</simpara>\r
1485 <simpara>Coming from a system such as Perforce or Subversion this should be\r
1486 quite simple, as the fast-import mark can also be the Perforce changeset\r
1487 number or the Subversion revision number.</simpara>\r
1488 </section>\r
1489 <section id="git-fast-import(1)__freely_skip_around_branches">\r
1490 <title>Freely Skip Around Branches</title>\r
1491 <simpara>Don't bother trying to optimize the frontend to stick to one branch\r
1492 at a time during an import.  Although doing so might be slightly\r
1493 faster for fast-import, it tends to increase the complexity of the frontend\r
1494 code considerably.</simpara>\r
1495 <simpara>The branch LRU builtin to fast-import tends to behave very well, and the\r
1496 cost of activating an inactive branch is so low that bouncing around\r
1497 between branches has virtually no impact on import performance.</simpara>\r
1498 </section>\r
1499 <section id="git-fast-import(1)__handling_renames">\r
1500 <title>Handling Renames</title>\r
1501 <simpara>When importing a renamed file or directory, simply delete the old\r
1502 name(s) and modify the new name(s) during the corresponding commit.\r
1503 Git performs rename detection after-the-fact, rather than explicitly\r
1504 during a commit.</simpara>\r
1505 </section>\r
1506 <section id="git-fast-import(1)__use_tag_fixup_branches">\r
1507 <title>Use Tag Fixup Branches</title>\r
1508 <simpara>Some other SCM systems let the user create a tag from multiple\r
1509 files which are not from the same commit/changeset.  Or to create\r
1510 tags which are a subset of the files available in the repository.</simpara>\r
1511 <simpara>Importing these tags as-is in Git is impossible without making at\r
1512 least one commit which fixes up the files to match the content\r
1513 of the tag.  Use fast-import's <emphasis>reset</emphasis> command to reset a dummy branch\r
1514 outside of your normal branch space to the base commit for the tag,\r
1515 then commit one or more file fixup commits, and finally tag the\r
1516 dummy branch.</simpara>\r
1517 <simpara>For example since all normal branches are stored under <emphasis>refs/heads/</emphasis>\r
1518 name the tag fixup branch <emphasis>TAG_FIXUP</emphasis>.  This way it is impossible for\r
1519 the fixup branch used by the importer to have namespace conflicts\r
1520 with real branches imported from the source (the name <emphasis>TAG_FIXUP</emphasis>\r
1521 is not <emphasis>refs/heads/TAG_FIXUP</emphasis>).</simpara>\r
1522 <simpara>When committing fixups, consider using <emphasis>merge</emphasis> to connect the\r
1523 commit(s) which are supplying file revisions to the fixup branch.\r
1524 Doing so will allow tools such as <emphasis>git blame</emphasis> to track\r
1525 through the real commit history and properly annotate the source\r
1526 files.</simpara>\r
1527 <simpara>After fast-import terminates the frontend will need to do <emphasis>rm .git/TAG_FIXUP</emphasis>\r
1528 to remove the dummy branch.</simpara>\r
1529 </section>\r
1530 <section id="git-fast-import(1)__import_now_repack_later">\r
1531 <title>Import Now, Repack Later</title>\r
1532 <simpara>As soon as fast-import completes the Git repository is completely valid\r
1533 and ready for use.  Typically this takes only a very short time,\r
1534 even for considerably large projects (100,000+ commits).</simpara>\r
1535 <simpara>However repacking the repository is necessary to improve data\r
1536 locality and access performance.  It can also take hours on extremely\r
1537 large projects (especially if -f and a large --window parameter is\r
1538 used).  Since repacking is safe to run alongside readers and writers,\r
1539 run the repack in the background and let it finish when it finishes.\r
1540 There is no reason to wait to explore your new Git project!</simpara>\r
1541 <simpara>If you choose to wait for the repack, don't try to run benchmarks\r
1542 or performance tests until repacking is completed.  fast-import outputs\r
1543 suboptimal packfiles that are simply never seen in real use\r
1544 situations.</simpara>\r
1545 </section>\r
1546 <section id="git-fast-import(1)__repacking_historical_data">\r
1547 <title>Repacking Historical Data</title>\r
1548 <simpara>If you are repacking very old imported data (e.g. older than the\r
1549 last year), consider expending some extra CPU time and supplying\r
1550 --window=50 (or higher) when you run <emphasis>git repack</emphasis>.\r
1551 This will take longer, but will also produce a smaller packfile.\r
1552 You only need to expend the effort once, and everyone using your\r
1553 project will benefit from the smaller repository.</simpara>\r
1554 </section>\r
1555 <section id="git-fast-import(1)__include_some_progress_messages">\r
1556 <title>Include Some Progress Messages</title>\r
1557 <simpara>Every once in a while have your frontend emit a <emphasis>progress</emphasis> message\r
1558 to fast-import.  The contents of the messages are entirely free-form,\r
1559 so one suggestion would be to output the current month and year\r
1560 each time the current commit date moves into the next month.\r
1561 Your users will feel better knowing how much of the data stream\r
1562 has been processed.</simpara>\r
1563 </section>\r
1564 </simplesect>\r
1565 <simplesect id="git-fast-import(1)__packfile_optimization">\r
1566 <title>Packfile Optimization</title>\r
1567 <simpara>When packing a blob fast-import always attempts to deltify against the last\r
1568 blob written.  Unless specifically arranged for by the frontend,\r
1569 this will probably not be a prior version of the same file, so the\r
1570 generated delta will not be the smallest possible.  The resulting\r
1571 packfile will be compressed, but will not be optimal.</simpara>\r
1572 <simpara>Frontends which have efficient access to all revisions of a\r
1573 single file (for example reading an RCS/CVS ,v file) can choose\r
1574 to supply all revisions of that file as a sequence of consecutive\r
1575 <emphasis>blob</emphasis> commands.  This allows fast-import to deltify the different file\r
1576 revisions against each other, saving space in the final packfile.\r
1577 Marks can be used to later identify individual file revisions during\r
1578 a sequence of <emphasis>commit</emphasis> commands.</simpara>\r
1579 <simpara>The packfile(s) created by fast-import do not encourage good disk access\r
1580 patterns.  This is caused by fast-import writing the data in the order\r
1581 it is received on standard input, while Git typically organizes\r
1582 data within packfiles to make the most recent (current tip) data\r
1583 appear before historical data.  Git also clusters commits together,\r
1584 speeding up revision traversal through better cache locality.</simpara>\r
1585 <simpara>For this reason it is strongly recommended that users repack the\r
1586 repository with <emphasis>git repack -a -d</emphasis> after fast-import completes, allowing\r
1587 Git to reorganize the packfiles for faster data access.  If blob\r
1588 deltas are suboptimal (see above) then also adding the <emphasis>-f</emphasis> option\r
1589 to force recomputation of all deltas can significantly reduce the\r
1590 final packfile size (30-50% smaller can be quite typical).</simpara>\r
1591 </simplesect>\r
1592 <simplesect id="git-fast-import(1)__memory_utilization">\r
1593 <title>Memory Utilization</title>\r
1594 <simpara>There are a number of factors which affect how much memory fast-import\r
1595 requires to perform an import.  Like critical sections of core\r
1596 Git, fast-import uses its own memory allocators to amortize any overheads\r
1597 associated with malloc.  In practice fast-import tends to amortize any\r
1598 malloc overheads to 0, due to its use of large block allocations.</simpara>\r
1599 <section id="git-fast-import(1)__per_object">\r
1600 <title>per object</title>\r
1601 <simpara>fast-import maintains an in-memory structure for every object written in\r
1602 this execution.  On a 32 bit system the structure is 32 bytes,\r
1603 on a 64 bit system the structure is 40 bytes (due to the larger\r
1604 pointer sizes).  Objects in the table are not deallocated until\r
1605 fast-import terminates.  Importing 2 million objects on a 32 bit system\r
1606 will require approximately 64 MiB of memory.</simpara>\r
1607 <simpara>The object table is actually a hashtable keyed on the object name\r
1608 (the unique SHA-1).  This storage configuration allows fast-import to reuse\r
1609 an existing or already written object and avoid writing duplicates\r
1610 to the output packfile.  Duplicate blobs are surprisingly common\r
1611 in an import, typically due to branch merges in the source.</simpara>\r
1612 </section>\r
1613 <section id="git-fast-import(1)__per_mark">\r
1614 <title>per mark</title>\r
1615 <simpara>Marks are stored in a sparse array, using 1 pointer (4 bytes or 8\r
1616 bytes, depending on pointer size) per mark.  Although the array\r
1617 is sparse, frontends are still strongly encouraged to use marks\r
1618 between 1 and n, where n is the total number of marks required for\r
1619 this import.</simpara>\r
1620 </section>\r
1621 <section id="git-fast-import(1)__per_branch">\r
1622 <title>per branch</title>\r
1623 <simpara>Branches are classified as active and inactive.  The memory usage\r
1624 of the two classes is significantly different.</simpara>\r
1625 <simpara>Inactive branches are stored in a structure which uses 96 or 120\r
1626 bytes (32 bit or 64 bit systems, respectively), plus the length of\r
1627 the branch name (typically under 200 bytes), per branch.  fast-import will\r
1628 easily handle as many as 10,000 inactive branches in under 2 MiB\r
1629 of memory.</simpara>\r
1630 <simpara>Active branches have the same overhead as inactive branches, but\r
1631 also contain copies of every tree that has been recently modified on\r
1632 that branch.  If subtree <emphasis>include</emphasis> has not been modified since the\r
1633 branch became active, its contents will not be loaded into memory,\r
1634 but if subtree <emphasis>src</emphasis> has been modified by a commit since the branch\r
1635 became active, then its contents will be loaded in memory.</simpara>\r
1636 <simpara>As active branches store metadata about the files contained on that\r
1637 branch, their in-memory storage size can grow to a considerable size\r
1638 (see below).</simpara>\r
1639 <simpara>fast-import automatically moves active branches to inactive status based on\r
1640 a simple least-recently-used algorithm.  The LRU chain is updated on\r
1641 each <emphasis>commit</emphasis> command.  The maximum number of active branches can be\r
1642 increased or decreased on the command line with --active-branches=.</simpara>\r
1643 </section>\r
1644 <section id="git-fast-import(1)__per_active_tree">\r
1645 <title>per active tree</title>\r
1646 <simpara>Trees (aka directories) use just 12 bytes of memory on top of the\r
1647 memory required for their entries (see per active file below).\r
1648 The cost of a tree is virtually 0, as its overhead amortizes out\r
1649 over the individual file entries.</simpara>\r
1650 </section>\r
1651 <section id="git-fast-import(1)__per_active_file_entry">\r
1652 <title>per active file entry</title>\r
1653 <simpara>Files (and pointers to subtrees) within active trees require 52 or 64\r
1654 bytes (32/64 bit platforms) per entry.  To conserve space, file and\r
1655 tree names are pooled in a common string table, allowing the filename\r
1656 Makefile to use just 16 bytes (after including the string header\r
1657 overhead) no matter how many times it occurs within the project.</simpara>\r
1658 <simpara>The active branch LRU, when coupled with the filename string pool\r
1659 and lazy loading of subtrees, allows fast-import to efficiently import\r
1660 projects with 2,000+ branches and 45,114+ files in a very limited\r
1661 memory footprint (less than 2.7 MiB per active branch).</simpara>\r
1662 </section>\r
1663 </simplesect>\r
1664 <simplesect id="git-fast-import(1)__signals">\r
1665 <title>Signals</title>\r
1666 <simpara>Sending <emphasis role="strong">SIGUSR1</emphasis> to the <emphasis>git fast-import</emphasis> process ends the current\r
1667 packfile early, simulating a <emphasis>checkpoint</emphasis> command.  The impatient\r
1668 operator can use this facility to peek at the objects and refs from an\r
1669 import in progress, at the cost of some added running time and worse\r
1670 compression.</simpara>\r
1671 </simplesect>\r
1672 <simplesect id="git-fast-import(1)__see_also">\r
1673 <title>SEE ALSO</title>\r
1674 <simpara><xref linkend="git-fast-export(1)" /></simpara>\r
1675 </simplesect>\r
1676 <simplesect id="git-fast-import(1)__git">\r
1677 <title>GIT</title>\r
1678 <simpara>Part of the <xref linkend="git(1)" /> suite</simpara>\r
1679 </simplesect>\r
1680 </sect2>\r