diff options
author | Edward Thomson <ethomson@microsoft.com> | 2015-09-23 13:40:12 -0400 |
---|---|---|
committer | Edward Thomson <ethomson@github.com> | 2016-05-26 13:01:06 -0500 |
commit | 82175084e17d31051e691ebdcb5990a12d0230e7 (patch) | |
tree | 07f65363bdf7c3dc0a667cf41f20d3ffca34ecaf /include/git2/patch.h | |
parent | 19e46645af31b594514cdf88e0ff037e15f39b9b (diff) | |
download | libgit2-82175084e17d31051e691ebdcb5990a12d0230e7.tar.gz |
Introduce git_patch_options, handle prefixes
Handle prefixes (in terms of number of path components) for patch
parsing.
Diffstat (limited to 'include/git2/patch.h')
-rw-r--r-- | include/git2/patch.h | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/include/git2/patch.h b/include/git2/patch.h index aa8729c9c..f2e2476d9 100644 --- a/include/git2/patch.h +++ b/include/git2/patch.h @@ -267,18 +267,31 @@ GIT_EXTERN(int) git_patch_to_buf( git_buf *out, git_patch *patch); +/** Options for parsing patch files. */ +typedef struct { + /** + * The length of the prefix (in path segments) for the filenames. + * This prefix will be removed when looking for files. The default is 1. + */ + uint32_t prefix_len; +} git_patch_options; + +#define GIT_PATCH_OPTIONS_INIT { 1 } + /** * 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 + * @param opts The git_patch_options * @return 0 on success, <0 on failure. */ GIT_EXTERN(int) git_patch_from_patchfile( git_patch **out, const char *patchfile, - size_t patchfile_len); + size_t patchfile_len, + git_patch_options *opts); GIT_END_DECL |