Skip to main content

parse_diff_shortstat

Function parse_diff_shortstat 

Source
pub fn parse_diff_shortstat(raw: &str) -> DiffLineStat
Expand description

Parse a git diff --shortstat summary line into a DiffLineStat (issue #287). The line looks like 3 files changed, 12 insertions(+), 4 deletions(-), but either the insertions or the deletions clause can be absent — an all-additions or all-deletions diff omits the empty side, and an empty diff yields an empty string. Any clause that’s missing counts as zero; the singular 1 insertion(+) / 1 deletion(-) forms are handled too.