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,
Nonefor 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. - Diff
Line - Diff
Model - File
Diff - Hash
Cache - 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 soFileDiffequality 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§
Functions§
- disambiguated_
hunk_ id hunk_idfor one hunk of a file whose other hunks are being assigned ids through the sameseenmap: 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.
occurrenceis 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_idis the usual way to call this, since it tracks the count for the caller.