libgit2

git_diff_patch_from_blob_and_buffer

Version:

Directly generate a patch from the difference between a blob and a buffer.

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

Signature

int git_diff_patch_from_blob_and_buffer(git_diff_patch **out, const git_blob *old_blob, const char *old_as_path, const char *buffer, size_t buffer_len, const char *buffer_as_path, const git_diff_options *opts);

Parameters

In
out

The generated patch; NULL on error

In
old_blob

Blob for old side of diff, or NULL for empty blob

const char *
In
old_as_path

Treat old blob as if it had this filename; can be NULL

const char *
In
buffer

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

size_t
In
buffer_len

Length of raw data for new side of diff

const char *
In
buffer_as_path

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

In
opts

Options for diff, or NULL for default options

Returns

int

0 on success or error code < 0

Versions