diff options
author | Edward Thomson <ethomson@github.com> | 2016-08-23 23:38:39 -0500 |
---|---|---|
committer | Edward Thomson <ethomson@github.com> | 2016-08-24 09:08:57 -0500 |
commit | b859faa61ce3f1fda5c29ac1e72a3d58fee2ede6 (patch) | |
tree | 976a27f8827db4200a172720b547fbf7ec1db119 /src/diff_parse.c | |
parent | c60210d36780a39db669e52d6d592d339c6a2ed3 (diff) | |
download | libgit2-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/diff_parse.c')
-rw-r--r-- | src/diff_parse.c | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/src/diff_parse.c b/src/diff_parse.c index ffdc8df88..e640063af 100644 --- a/src/diff_parse.c +++ b/src/diff_parse.c @@ -6,15 +6,10 @@ */ #include "common.h" #include "diff.h" +#include "diff_parse.h" #include "patch.h" #include "patch_parse.h" -typedef struct { - struct git_diff base; - - git_vector patches; -} git_diff_parsed; - static void diff_parsed_free(git_diff *d) { git_diff_parsed *diff = (git_diff_parsed *)d; @@ -47,6 +42,7 @@ static git_diff_parsed *diff_parsed_alloc(void) diff->base.strncomp = git__strncmp; diff->base.pfxcomp = git__prefixcmp; diff->base.entrycomp = git_diff__entry_cmp; + diff->base.patch_fn = git_patch_parsed_from_diff; diff->base.free_fn = diff_parsed_free; git_pool_init(&diff->base.pool, 1); |