summaryrefslogtreecommitdiff
path: root/include/git2
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@github.com>2016-04-25 12:40:19 -0400
committerEdward Thomson <ethomson@github.com>2016-05-26 13:01:09 -0500
commit728274904f69fef48752d77c8cf75fc3aaf7808c (patch)
tree555080de1f33ec4c5afecb71e6a81a0c060e8ca5 /include/git2
parent7166bb16659790ae2b398e1e95c752f784f6f1d3 (diff)
downloadlibgit2-728274904f69fef48752d77c8cf75fc3aaf7808c.tar.gz
Introduce `git_diff_to_buf`
Like `git_patch_to_buf`, provide a simple helper method that can print an entire diff directory to a `git_buf`.
Diffstat (limited to 'include/git2')
-rw-r--r--include/git2/diff.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/include/git2/diff.h b/include/git2/diff.h
index 880292a1f..005b33965 100644
--- a/include/git2/diff.h
+++ b/include/git2/diff.h
@@ -1054,6 +1054,21 @@ GIT_EXTERN(int) git_diff_print(
git_diff_line_cb print_cb,
void *payload);
+/**
+ * Produce the complete formatted text output from a diff into a
+ * buffer.
+ *
+ * @param out A pointer to a user-allocated git_buf that will
+ * contain the diff text
+ * @param diff A git_diff generated by one of the above functions.
+ * @param format A git_diff_format_t value to pick the text format.
+ * @return 0 on success or error code
+ */
+GIT_EXTERN(int) git_diff_to_buf(
+ git_buf *out,
+ git_diff *diff,
+ git_diff_format_t format);
+
/**@}*/