Skip to main content

slice_hunk

Function slice_hunk 

Source
pub fn slice_hunk(
    hunk: &DiffHunk,
    start: usize,
    end: usize,
    reverse: bool,
) -> Result<DiffHunk>
Expand description

Slice a hunk to only include changes within the given 1-based line range. Lines outside the range have their changes neutralized:

  • excluded ‘+’ lines are dropped
  • excluded ‘-’ lines become context (the deletion is kept)

Context lines are always preserved for patch validity.