summaryrefslogtreecommitdiff
path: root/include/git2
diff options
context:
space:
mode:
Diffstat (limited to 'include/git2')
-rw-r--r--include/git2/apply.h32
1 files changed, 21 insertions, 11 deletions
diff --git a/include/git2/apply.h b/include/git2/apply.h
index 3bf6aad63..cdeb9ed4c 100644
--- a/include/git2/apply.h
+++ b/include/git2/apply.h
@@ -22,6 +22,21 @@
GIT_BEGIN_DECL
/**
+ * Apply options structure
+ *
+ * Initialize with `GIT_APPLY_OPTIONS_INIT`. Alternatively, you can
+ * use `git_apply_init_options`.
+ *
+ * @see git_apply_to_tree, git_apply
+ */
+typedef struct {
+ unsigned int version;
+} git_apply_options;
+
+#define GIT_APPLY_OPTIONS_VERSION 1
+#define GIT_APPLY_OPTIONS_INIT {GIT_APPLY_OPTIONS_VERSION}
+
+/**
* Apply a `git_diff` to a `git_tree`, and return the resulting image
* as an index.
*
@@ -29,12 +44,14 @@ GIT_BEGIN_DECL
* @param repo the repository to apply
* @param preimage the tree to apply the diff to
* @param diff the diff to apply
+ * @param options the options for the apply (or null for defaults)
*/
GIT_EXTERN(int) git_apply_to_tree(
git_index **out,
git_repository *repo,
git_tree *preimage,
- git_diff *diff);
+ git_diff *diff,
+ const git_apply_options *options);
typedef enum {
/**
@@ -56,27 +73,20 @@ typedef enum {
GIT_APPLY_LOCATION_BOTH = 2,
} git_apply_location_t;
-typedef struct {
- unsigned int version;
-
- git_apply_location_t location;
-} git_apply_options;
-
-#define GIT_APPLY_OPTIONS_VERSION 1
-#define GIT_APPLY_OPTIONS_INIT {GIT_APPLY_OPTIONS_VERSION}
-
/**
* Apply a `git_diff` to the given repository, making changes directly
* in the working directory, the index, or both.
*
* @param repo the repository to apply to
* @param diff the diff to apply
+ * @param location the location to apply (workdir, index or both)
* @param options the options for the apply (or null for defaults)
*/
GIT_EXTERN(int) git_apply(
git_repository *repo,
git_diff *diff,
- git_apply_options *options);
+ git_apply_location_t location,
+ const git_apply_options *options);
/** @} */
GIT_END_DECL