get_hunks

Function get_hunks 

Source
pub fn get_hunks(raw_diff_output: &[String]) -> Result<Vec<(&str, usize)>>
Expand description

Extracts file paths and starting line numbers of hunks from git diff output.

§Errors

  • Missing path delimiter in the diff line.
  • Unable to extract the filepath from the diff line.
  • Unable to access subsequent lines for line numbers.
  • Missing comma delimiter in the hunk header.
  • Unable to extract the line number from the hunk header.
  • Line number cannot be parsed as a valid usize.

§Assumptions

Assumes raw_diff_output is in standard unified diff format produced by git diff.