summaryrefslogtreecommitdiff
path: root/src/patch.c
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@github.com>2016-08-23 23:38:39 -0500
committerEdward Thomson <ethomson@github.com>2016-08-24 09:08:57 -0500
commitb859faa61ce3f1fda5c29ac1e72a3d58fee2ede6 (patch)
tree976a27f8827db4200a172720b547fbf7ec1db119 /src/patch.c
parentc60210d36780a39db669e52d6d592d339c6a2ed3 (diff)
downloadlibgit2-ethomson/patch_from_diff.tar.gz
Teach `git_patch_from_diff` about parsed diffsethomson/patch_from_diff
Ensure that `git_patch_from_diff` can return the patch for parsed diffs, not just generate a patch for a generated diff.
Diffstat (limited to 'src/patch.c')
-rw-r--r--src/patch.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/patch.c b/src/patch.c
index e14ffa9c0..ad24b0714 100644
--- a/src/patch.c
+++ b/src/patch.c
@@ -194,6 +194,12 @@ int git_patch_get_line_in_hunk(
return 0;
}
+int git_patch_from_diff(git_patch **out, git_diff *diff, size_t idx)
+{
+ assert(out && diff && diff->patch_fn);
+ return diff->patch_fn(out, diff, idx);
+}
+
static void git_patch__free(git_patch *patch)
{
if (patch->free_fn)