diff options
Diffstat (limited to 'include/git2')
| -rw-r--r-- | include/git2/diff.h | 14 | ||||
| -rw-r--r-- | include/git2/patch.h | 13 |
2 files changed, 21 insertions, 6 deletions
diff --git a/include/git2/diff.h b/include/git2/diff.h index c35701a46..f3bb337b7 100644 --- a/include/git2/diff.h +++ b/include/git2/diff.h @@ -448,6 +448,8 @@ typedef int (*git_diff_file_cb)( float progress, void *payload); +#define GIT_DIFF_HUNK_HEADER_SIZE 128 + /** * When producing a binary diff, the binary data returned will be * either the deflated full ("literal") contents of the file, or @@ -499,12 +501,12 @@ typedef int(*git_diff_binary_cb)( * Structure describing a hunk of a diff. */ typedef struct { - int old_start; /**< Starting line number in old_file */ - int old_lines; /**< Number of lines in old_file */ - int new_start; /**< Starting line number in new_file */ - int new_lines; /**< Number of lines in new_file */ - size_t header_len; /**< Number of bytes in header text */ - char header[128]; /**< Header text, NUL-byte terminated */ + int old_start; /** Starting line number in old_file */ + int old_lines; /** Number of lines in old_file */ + int new_start; /** Starting line number in new_file */ + int new_lines; /** Number of lines in new_file */ + size_t header_len; /** Number of bytes in header text */ + char header[GIT_DIFF_HUNK_HEADER_SIZE]; /** Header text, NUL-byte terminated */ } git_diff_hunk; /** diff --git a/include/git2/patch.h b/include/git2/patch.h index 790cb74fc..aa8729c9c 100644 --- a/include/git2/patch.h +++ b/include/git2/patch.h @@ -267,6 +267,19 @@ GIT_EXTERN(int) git_patch_to_buf( git_buf *out, git_patch *patch); +/** + * Create a patch from the contents of a patch file. + * + * @param out The patch to be created + * @param patchfile The contents of a patch file + * @param patchfile_len The length of the patch file + * @return 0 on success, <0 on failure. + */ +GIT_EXTERN(int) git_patch_from_patchfile( + git_patch **out, + const char *patchfile, + size_t patchfile_len); + GIT_END_DECL /**@}*/ |
