pub fn apply_patch_file(
patch_text: &str,
cwd: &Path,
mode: ApplyMode,
guard: Option<&PathGuard>,
) -> Result<Vec<EditResult>>Expand description
Apply a multi-file patch. Returns one EditResult per affected file.
Retains direct implementation since it produces multiple EditResults
(one per file), which the single-op execute_as_edit_result adapter
doesn’t support.
Atomic Apply: all files are load+hunk preflighted first; on Apply a
single backup session covers every path. Any write failure restores the
whole batch (no half-applied multi-file patch). Empty-create dests report
changed: true even when original and new content are both empty.
Deletes: empty-hunk +++ /dev/null (git deleted file mode, no hunks)
unlinks. A hunked delete applies the minus lines first; leftover bytes
rewrite the file (preview --diff or new_content). Path-only unlink is
file.delete. Stale minus lines are ambiguous and the file stays.
A missing dest peels not_found on Apply and Check (do not treat it
as changed: true).