pub struct FilePatch {Show 23 fields
pub diff_old_path: Option<String>,
pub diff_new_path: Option<String>,
pub old_path: Option<String>,
pub new_path: Option<String>,
pub saw_old_header: bool,
pub saw_new_header: bool,
pub old_mode: Option<String>,
pub new_mode: Option<String>,
pub old_mode_line: Option<usize>,
pub new_mode_line: Option<usize>,
pub is_new: bool,
pub is_deleted: bool,
pub is_rename: bool,
pub is_copy: bool,
pub similarity_index: Option<u32>,
pub dissimilarity_index: Option<u32>,
pub old_oid: Option<String>,
pub new_oid: Option<String>,
pub binary_patch: Option<BinaryPatchPayload>,
pub is_binary: bool,
pub hunks: Vec<Hunk>,
pub ws_rule: u32,
pub is_toplevel_relative: bool,
}Expand description
Represents one file in a unified diff.
Fields§
§diff_old_path: Option<String>Path from diff --git old side (a/...) when present.
diff_new_path: Option<String>Path from diff --git new side (b/...) when present.
old_path: Option<String>Path on the old side (None for new files).
new_path: Option<String>Path on the new side (None for deleted files).
saw_old_header: boolWhether an explicit --- header line was present.
saw_new_header: boolWhether an explicit +++ header line was present.
old_mode: Option<String>Old mode from extended header.
new_mode: Option<String>New mode from extended header.
old_mode_line: Option<usize>Source line (1-based) of old mode / deleted file mode for diagnostics.
new_mode_line: Option<usize>Source line (1-based) of new mode / new file mode for diagnostics.
is_new: boolWhether this file is being newly created.
is_deleted: boolWhether this file is being deleted.
is_rename: boolWhether this is a rename.
is_copy: boolWhether this is a copy.
similarity_index: Option<u32>Similarity index (e.g., 90 for 90%).
dissimilarity_index: Option<u32>Dissimilarity index for rewrites.
old_oid: Option<String>Old blob OID from the index header (abbreviated).
new_oid: Option<String>New blob OID from the index header (abbreviated).
binary_patch: Option<BinaryPatchPayload>Parsed binary patch payload (GIT binary patch) if present.
is_binary: boolWhether this is a binary change (GIT binary patch payload or a
Binary files ... differ marker); stat/numstat show Bin / -.
hunks: Vec<Hunk>Hunks to apply.
ws_rule: u32Merged core.whitespace + whitespace attribute (Git ws_rule); 0 before assignment.
is_toplevel_relative: boolGit patch->is_toplevel_relative: set for diff --git patches only. When false, paths are
prefixed with the setup directory (work-tree-relative CWD) like prefix_patch in Git.