Skip to main content

Module hunk_id

Module hunk_id 

Source
Expand description

Stable identifiers for structured diff hunks (patch selection in later steps).

Ids hash side, path, and hunk line bodies (not line numbers) so they stay stable when earlier hunks are staged and later hunks shift in the file.

Structs§

HunkId
Twelve lowercase hex characters identifying one structured hunk within a side and path.

Enums§

DiffSide
Which tree/index/worktree sides a hunk was produced from.
HunkIdError
Parse or format failure for HunkId.

Functions§

hunk_ids
Stable ids for hunks in file order (0-based index matches vector position).
hunk_ids_with_duplicate_peers
Like hunk_ids, but peer_hunks on the same path (typically the other index/worktree side) participate in duplicate-body detection so ids stay stable when an earlier identical hunk moves to the staged side.
peer_hunks_by_primary_path
Keep structured peer hunks only for paths present in the primary side.
peer_scope_includes_path
True when a diff entry’s displayed or old path is listed in the primary change set.