summaryrefslogtreecommitdiff
path: root/src/patch.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/patch.h')
-rw-r--r--src/patch.h26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/patch.h b/src/patch.h
index b818c5cbe..28fe766da 100644
--- a/src/patch.h
+++ b/src/patch.h
@@ -50,6 +50,32 @@ extern int git_patch_line_stats(
size_t *total_dels,
const 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 for a single file from the contents of a patch buffer.
+ *
+ * @param out The patch to be created
+ * @param contents The contents of a patch file
+ * @param contents_len The length of the patch file
+ * @param opts The git_patch_options
+ * @return 0 on success, <0 on failure.
+ */
+extern int git_patch_from_buffer(
+ git_patch **out,
+ const char *contents,
+ size_t contents_len,
+ git_patch_options *opts);
+
extern void git_patch_free(git_patch *patch);
#endif