Expand description
Git index (staging area) reading and writing.
The index file (.git/index) stores the current state of the staging area.
It uses a binary format with a 12-byte header, fixed-size index entries,
and optional extensions, followed by a trailing SHA-1 over the whole file.
§Format version
This implementation supports index versions 2 and 3. Requests for version 4 currently fall back to a non-compressed index on write because path compression is not yet implemented.
§References
See Documentation/technical/index-format.txt in the Git source tree for
the authoritative format specification.
Structs§
- Index
- The in-memory representation of the Git index file.
- Index
Entry - A single entry in the Git index.
- Index
Load Options - Options for loading an index from disk.
Constants§
- MODE_
EXECUTABLE - File mode for an executable file.
- MODE_
GITLINK - File mode for a gitlink (submodule).
- MODE_
REGULAR - File mode for a regular (non-executable) file.
- MODE_
SYMLINK - File mode for a symbolic link.
- MODE_
TREE - File mode for a directory (tree) entry — only used in tree objects, not index.
Functions§
- entry_
from_ metadata - Build an
IndexEntryfrom already-obtained metadata. - entry_
from_ stat - Build an
IndexEntryby stat-ing a file on disk. - get_
index_ format_ from_ env - Read
GIT_INDEX_VERSIONand return the requested version. - normalize_
mode - Convert a
statmode to the Git index mode, normalised to one of the known constants (MODE_REGULAR,MODE_EXECUTABLE,MODE_SYMLINK).