git_diff_blob_to_buffer

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_t.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.

extern (C) nothrow @nogc
int
git_diff_blob_to_buffer

Parameters

old_blob const(libgit2_d.types.git_blob)*

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

old_as_path const(char)*

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

buffer const(char)*

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

buffer_len size_t

Length of raw data for new side of diff

buffer_as_path const(char)*

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

options const(.git_diff_options)*

Options for diff, or null for default options

file_cb .git_diff_file_cb

Callback for "file"; made once if there is a diff; can be null

binary_cb .git_diff_binary_cb

Callback for binary files; can be null

hunk_cb .git_diff_hunk_cb

Callback for each hunk in diff; can be null

line_cb .git_diff_line_cb

Callback for each line in diff; can be null

payload void*

Payload passed to each callback function

Return Value

Type: int

0 on success, non-zero callback return value, or error code

Meta