Skip to main content

Module model

Module model 

Source
Expand description

Diff model: what changed, organized as files -> hunks -> lines.

Structs§

BlobIds
The git blob ids of a file’s two sides, hex-encoded, None for a side that does not exist (an add, a delete). A working-tree side’s id is only a hash of the file on disk, with no object behind it in the store.
DiffLine
DiffModel
FileDiff
HashCache
Memo slots for FileDiff::content_hash/FileDiff::sides_hash, which the UI probes every frame: hashing full file contents per frame is the cost this avoids. Compares equal always so FileDiff equality is on data.
Hunk
HunkId
Stable identity for a hunk: hash of its normalized content. Survives edits elsewhere in the file; changes when the hunk’s lines change.

Enums§

FileStatus
LineKind

Functions§

disambiguated_hunk_id
hunk_id for one hunk of a file whose other hunks are being assigned ids through the same seen map: each distinct content gets occurrence 0 the first time and counts up from there, so two identical hunks in one file never collide.
hunk_id
Hash the hunk’s content (kinds + text) into a stable id. occurrence is how many earlier hunks in the same file hash to the same content: two hunks with byte-identical lines in one file get distinct ids this way, while every other hunk’s id depends on its own content alone, so it survives edits elsewhere in the file. disambiguated_hunk_id is the usual way to call this, since it tracks the count for the caller.