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