Skip to main content

parse_patch

Function parse_patch 

Source
pub fn parse_patch(
    input: &str,
    strip: usize,
    input_name: &str,
    recount: bool,
    setup_prefix: Option<&str>,
) -> Result<Vec<FilePatch>>
Expand description

Parse a unified diff into a list of FilePatch entries.

strip is Git’s p_value (-p count, default 1). setup_prefix is Git’s setup_git_directory prefix (work-tree-relative path from CWD to the repo root, with trailing /); pass None when running from the work-tree root. The caller computes it because it is a CLI/environment concern.