pub fn parse_unified_diff(
diff_text: &str,
scope: Scope,
) -> Result<(Vec<DiffLine>, DiffStats), DiffParseError>Expand description
Parse a unified diff (git-style) and return scoped lines in diff order.
scope controls whether we return:
Scope::Added: all added linesScope::Changed: only added lines that directly follow at least one removed line in the same hunkScope::Modified: alias ofScope::ChangedScope::Deleted: removed lines
Special cases handled:
- Binary files: skipped (no lines extracted)
- Submodule changes: skipped (no lines extracted)
- Deleted files: skipped unless
scope = deleted - Mode-only changes: skipped (no lines extracted)
- Renamed files: uses the new (destination) path
- Malformed content: continues processing subsequent files