git_patch_from_buffers

Directly generate a patch from the difference between two buffers.

This is just like git_diff_buffers() except it generates a patch object for the difference instead of directly making callbacks. You can use the standard git_patch accessor functions to read the patch data, and you must call git_patch_free() on the patch when done.

extern (C) nothrow @nogc
int
git_patch_from_buffers
(,
const(void)* old_buffer
,
size_t old_len
,
const(char)* old_as_path
,
const(void)* new_buffer
,
size_t new_len
,
const(char)* new_as_path
,)

Parameters

out_ .git_patch**

The generated patch; null on error

old_buffer const(void)*

Raw data for old side of diff, or null for empty

old_len size_t

Length of the raw data for old side of the diff

old_as_path const(char)*

Treat old buffer as if it had this filename; can be null

new_buffer const(void)*

Raw data for new side of diff, or null for empty

new_len size_t

Length of raw data for new side of diff

new_as_path const(char)*

Treat buffer as if it had this filename; can be null

opts const(libgit2_d.diff.git_diff_options)*

Options for diff, or null for default options

Return Value

Type: int

0 on success or error code < 0

Meta