git_diff_blobs

Directly run a diff on two blobs.

Compared to a file, a blob lacks some contextual information. As such, the git_diff_file given to the callback will have some fake data; i.e. mode will be 0 and path will be null.

null is allowed for either old_blob or new_blob and will be treated as an empty blob, with the oid set to null in the git_diff_file data. Passing null for both blobs is a noop; no callbacks will be made at all.

We do run a binary content check on the blob content and if either blob looks like binary data, the git_diff_delta binary attribute will be set to 1 and no call to the hunk_cb nor line_cb will be made (unless you pass git_diff_option_t.GIT_DIFF_FORCE_TEXT of course).

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

new_blob const(libgit2_d.types.git_blob)*

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

new_as_path const(char)*

Treat new blob 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