pub fn write_patch_resolved<W: Write>(
repo: &Repository,
files: &[PatchResolvedSide],
opts: &PatchTextOptions,
out: &mut W,
) -> Result<()>Expand description
Write git diff --binary-compatible patch text for files whose sides may live in memory,
the object database, or the work tree (index and work-tree diffs).
Binary files are written as GIT binary patch sections. The index line carries abbreviated
blob ids for the content actually written: PatchSide::Blob keeps the entry oid,
PatchSide::Bytes and PatchSide::Worktree are hashed at render time (no ODB write),
gitlinks keep their commit oids, and absent sides stay zero. Work-tree diffs often arrive
with a zero new oid even for text files; filling ids here keeps git apply --3way usable.
§Parameters
repo: repository for objects, config, and (forPatchSide::Worktree) the work tree and index.files: files to write, in output order.opts: hunk and abbreviation settings.out: destination for patch bytes.
§Errors
Returns Error::RequiresWorkTree when a
PatchSide::Worktree side is requested in a bare repository, and propagates index, ODB,
work-tree, hashing and I/O errors.