Skip to main content

Module diff

Module diff 

Source
Expand description

Minimal unified-diff parser.

Intentionally hand-rolled to keep dependency surface tiny. Handles the subset of unified-diff output produced by git diff and diff -u that the detectors need:

  • diff --git a/... b/... or --- a/... / +++ b/... file headers
  • @@ -old_start,old_count +new_start,new_count @@ hunk headers
  • + / - / body lines

It is not a general patch applier. Line numbers on changed lines are tracked relative to the new file for high-precision reporting.

Structs§

AddedLine
An added line with its line number in the new file.
ChangedHunk
A single changed hunk within a file.
Diff
A parsed unified diff.

Enums§

DiffError
Errors returned by parse_unified_diff.

Functions§

parse_unified_diff
Parse a unified diff into a Diff.