summaryrefslogtreecommitdiff
path: root/include/git2/diff.h
diff options
context:
space:
mode:
authorRussell Belfer <rb@github.com>2012-10-24 20:56:32 -0700
committerRussell Belfer <rb@github.com>2012-10-24 20:56:32 -0700
commit93cf7bb8e26a04d9bd4197c1b938cee352023f63 (patch)
tree34fc8c5fbf63e3962573d768c252197bcdf177e3 /include/git2/diff.h
parent6f6b0c013c6eff2aca2a7ada1027044f2e20f578 (diff)
downloadlibgit2-93cf7bb8e26a04d9bd4197c1b938cee352023f63.tar.gz
Add git_diff_patch_to_str API
This adds an API to generate a complete single-file patch text from a git_diff_patch object.
Diffstat (limited to 'include/git2/diff.h')
-rw-r--r--include/git2/diff.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/include/git2/diff.h b/include/git2/diff.h
index 1932db029..1c2a2f83a 100644
--- a/include/git2/diff.h
+++ b/include/git2/diff.h
@@ -603,6 +603,17 @@ GIT_EXTERN(int) git_diff_patch_get_line_in_hunk(
size_t hunk_idx,
size_t line_of_hunk);
+/**
+ * Get the content of a patch as a single diff text.
+ *
+ * @param string Allocated string; caller must free.
+ * @param patch The patch to generate a string from.
+ * @return 0 on success, <0 on failure.
+ */
+GIT_EXTERN(int) git_diff_patch_to_str(
+ char **string,
+ git_diff_patch *patch);
+
/**@}*/