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