Skip to main content

hunk_ordinal_at

Function hunk_ordinal_at 

Source
pub fn hunk_ordinal_at(
    read: impl Fn(usize) -> Option<String>,
    header_row: usize,
) -> usize
Expand description

MG.18d: the 0-based index of the hunk whose header sits at header_row, among the hunks of the file it belongs to.

The ordinal is what survives a rebuild: staging hunk k removes it, so ordinal k then names the hunk that took its place. Counted backwards from the hunk to its diff --git line, so it is the same walk hunk_at_with already does and cannot disagree with it about where the file starts.