Skip to main content

parse_diff

Function parse_diff 

Source
pub fn parse_diff(diff: &str) -> Vec<FileDiff>
Expand description

Parse a git-format unified diff into one FileDiff per file. Works on git diff and jj diff --git output alike. Public so a consumer can parse diff text it obtained by other means.

Paths are read from the unambiguous single-path lines (+++ b/…, --- a/…, rename to …) rather than the space-ambiguous diff --git a/… b/… header, and normalised to forward slashes. Ported from the vcs-flow-commit parser.