Skip to main content

Module index_flags

Module index_flags 

Source
Expand description

A read of the assume-unchanged and skip-worktree marks of an index file. What: A read of the per-entry flags of an index file that decide whether the index may seed an explicit-path commit: whether any entry is marked assume-unchanged, skip-worktree or intent-to-add. Why: A private index copied from the real index and reset to the base keeps those marks, and git add --all -- <path> then skips a marked file the commit named (assume-unchanged) or refuses it (skip-worktree), where Git’s own partial commit and the previous flow staged it; an intent-to-add entry of a tracked empty file survives the reset and is then left out of the tree, so the commit loses that file. Finding a mark needs the whole file, and a Git start for it would add a process to every commit, so the entries are read here; anything this reader does not fully understand answers “unreadable”, and the caller then builds the index the slower, always-correct way. The layout is the one in Git’s gitformat-index documentation: a 12-byte header, entries (versions 2 to 4), then extensions and a trailing checksum.

In TS you’d write (pseudocode):

const flags = readIndexFlags(await readFile(indexPath)); // 'plain' | 'marked' | 'unreadable'

Enums§

IndexFlags
What a read of an index file found.

Functions§

read_index_flags
What: Whether an index file has an entry marked assume-unchanged or skip-worktree. Why: Both object name lengths are tried because the reader is not told the repository’s object format; a layout that adds up for neither is unreadable, never “plain”.