libgit2

git_diff_blob_to_buffer

Version:

Directly run a diff between a blob and a buffer.

As with git_diff_blobs, comparing a blob and buffer lacks some context, so the git_diff_file parameters to the callbacks will be faked a la the rules for git_diff_blobs().

Passing NULL for old_blob will be treated as an empty blob (i.e. the file_cb will be invoked with GIT_DELTA_ADDED and the diff will be the entire content of the buffer added). Passing NULL to the buffer will do the reverse, with GIT_DELTA_REMOVED and blob content removed.

Signature

int git_diff_blob_to_buffer(const git_blob *old_blob, const char *buffer, size_t buffer_len, const git_diff_options *options, git_diff_file_cb file_cb, git_diff_hunk_cb hunk_cb, git_diff_data_cb data_cb, void *payload);

Parameters

In
old_blob
const char *
In
buffer
size_t
In
buffer_len
In
file_cb
In
hunk_cb
In
data_cb
void *
In
payload

Returns

int

0 on success, GIT_EUSER on non-zero callback, or error code

Versions