summaryrefslogtreecommitdiff
path: root/include/git2/patch.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/git2/patch.h')
-rw-r--r--include/git2/patch.h15
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