diff options
author | Ignacio Casal Quinteiro <icq@gnome.org> | 2012-12-21 20:57:43 +0100 |
---|---|---|
committer | Russell Belfer <rb@github.com> | 2013-01-07 14:13:18 -0800 |
commit | f6234cd994ad01fb3aa8c2f0fd8e3d2cf89cf3f2 (patch) | |
tree | a5ec46eed9aab708deb654753fdb7bbaf9459ec5 /include/git2/diff.h | |
parent | 7dfc5c3c6c4cebe6e2477186a8e7ed6e7dba2c55 (diff) | |
download | libgit2-f6234cd994ad01fb3aa8c2f0fd8e3d2cf89cf3f2.tar.gz |
Introduce git_diff_blob_to_buffer
Diffstat (limited to 'include/git2/diff.h')
-rw-r--r-- | include/git2/diff.h | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/include/git2/diff.h b/include/git2/diff.h index 760de6fd1..f1c0cd969 100644 --- a/include/git2/diff.h +++ b/include/git2/diff.h @@ -824,6 +824,30 @@ GIT_EXTERN(int) git_diff_blobs( git_diff_data_cb line_cb, void *payload); +/** + * Directly run a text diff between a blob and a buffer. + * + * Compared to a file, a blob and a buffer lack some contextual information. As such, + * the `git_diff_file` parameters of the callbacks will be filled + * accordingly to the following: `mode` will be set to 0, `path` will be set + * to NULL. When dealing with a NULL blob, `oid` will be set to 0. + * + * When at least the blob or the buffer are binary, the + * `git_diff_delta` binary attribute will be set to 1 and no call to the + * hunk_cb nor line_cb will be made. + * + * @return 0 on success, GIT_EUSER on non-zero callback, or error code + */ +GIT_EXTERN(int) git_diff_blob_to_buffer( + git_blob *old_blob, + 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); + GIT_END_DECL /** @} */ |