Skip to main content

hunk_id

Function hunk_id 

Source
pub fn hunk_id(file_path: &str, lines: &[DiffLine], occurrence: usize) -> HunkId
Expand description

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.