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