Skip to main content

parse_hunks

Function parse_hunks 

Source
pub fn parse_hunks(
    path: impl Into<PathBuf>,
    status: FileStatus,
    patch: &str,
) -> FileDiff
Expand description

Parses the hunks of one file’s patch (what a hosting API returns per file: @@ -a,b +c,d @@ sections, no diff --git / --- / +++ header) into a FileDiff for path with the given status. Anything before the first @@ line is skipped, so a patch that does carry ---/+++ lines parses the same. An empty patch (a binary file, a mode change, a rename without edits) has no hunks.