Home Explore Blog CI



git

4th chunk of `Documentation/gitformat-index.adoc`
1b1d98c1d7d571a34cf86a7f2bbec417ddd122f5a52de4280000000100000c15
 The extension consists of:

  - Hash of the shared index file. The shared index file path
    is $GIT_DIR/sharedindex.<hash>. If all bits are zero, the
    index does not require a shared index file.

  - An ewah-encoded delete bitmap, each bit represents an entry in the
    shared index. If a bit is set, its corresponding entry in the
    shared index will be removed from the final index.  Note, because
    a delete operation changes index entry positions, but we do need
    original positions in replace phase, it's best to just mark
    entries for removal, then do a mass deletion after replacement.

  - An ewah-encoded replace bitmap, each bit represents an entry in
    the shared index. If a bit is set, its corresponding entry in the
    shared index will be replaced with an entry in this index
    file. All replaced entries are stored in sorted order in this
    index. The first "1" bit in the replace bitmap corresponds to the
    first index entry, the second "1" bit to the second entry and so
    on. Replaced entries may have empty path names to save space.

  The remaining index entries after replaced ones will be added to the
  final index. These added entries are also sorted by entry name then
  stage.

== Untracked cache

  Untracked cache saves the untracked file list and necessary data to
  verify the cache. The signature for this extension is { 'U', 'N',
  'T', 'R' }.

  The extension starts with

  - A sequence of NUL-terminated strings, preceded by the size of the
    sequence in variable width encoding. Each string describes the
    environment where the cache can be used.

  - Stat data of $GIT_DIR/info/exclude. See "Index entry" section from
    ctime field until "file size".

  - Stat data of core.excludesFile

  - 32-bit dir_flags (see struct dir_struct)

  - Hash of $GIT_DIR/info/exclude. A null hash means the file
    does not exist.

  - Hash of core.excludesFile. A null hash means the file does
    not exist.

  - NUL-terminated string of per-dir exclude file name. This usually
    is ".gitignore".

  - The number of following directory blocks, variable width
    encoding. If this number is zero, the extension ends here with a
    following NUL.

  - A number of directory blocks in depth-first-search order, each
    consists of

    - The number of untracked entries, variable width encoding.

    - The number of sub-directory blocks, variable width encoding.

    - The directory name terminated by NUL.

    - A number of untracked file/dir names terminated by NUL.

The remaining data of each directory block is grouped by type:

  - An ewah bitmap, the n-th bit marks whether the n-th directory has
    valid untracked cache entries.

  - An ewah bitmap, the n-th bit records "check-only" bit of
    read_directory_recursive() for the n-th directory.

  - An ewah bitmap, the n-th bit indicates whether hash and stat data
    is valid for the n-th directory and exists in the next data.

  - An array of stat data. The n-th data corresponds with the n-th
    "one" bit in the previous ewah bitmap.

  - An array of hashes.

Title: Git Index Extensions: Split Index and Untracked Cache
Summary
This section describes two Git index extensions: the split index extension, which stores changes to be made on top of a shared index file, and the untracked cache extension, which saves the untracked file list and verification data, including environment information, stat data, and hash values.