vendor/libgit2/include/git2/apply.h in rugged-0.28.3.1 vs vendor/libgit2/include/git2/apply.h in rugged-0.28.4
- old
+ new
@@ -51,29 +51,48 @@
*/
typedef int GIT_CALLBACK(git_apply_hunk_cb)(
const git_diff_hunk *hunk,
void *payload);
+/** Flags controlling the behavior of git_apply */
+typedef enum {
+ /**
+ * Don't actually make changes, just test that the patch applies.
+ * This is the equivalent of `git apply --check`.
+ */
+ GIT_APPLY_CHECK = (1 << 0),
+} git_apply_flags_t;
+
/**
* Apply options structure
*
* Initialize with `GIT_APPLY_OPTIONS_INIT`. Alternatively, you can
- * use `git_apply_init_options`.
+ * use `git_apply_options_init`.
*
* @see git_apply_to_tree, git_apply
*/
typedef struct {
- unsigned int version;
+ unsigned int version; /**< The version */
+ /** When applying a patch, callback that will be made per delta (file). */
git_apply_delta_cb delta_cb;
+
+ /** When applying a patch, callback that will be made per hunk. */
git_apply_hunk_cb hunk_cb;
+
+ /** Payload passed to both delta_cb & hunk_cb. */
void *payload;
+
+ /** Bitmask of git_apply_flags_t */
+ unsigned int flags;
} git_apply_options;
#define GIT_APPLY_OPTIONS_VERSION 1
#define GIT_APPLY_OPTIONS_INIT {GIT_APPLY_OPTIONS_VERSION}
+GIT_EXTERN(int) git_apply_options_init(git_apply_options *opts, unsigned int version);
+
/**
* Apply a `git_diff` to a `git_tree`, and return the resulting image
* as an index.
*
* @param out the postimage of the application
@@ -87,9 +106,10 @@
git_repository *repo,
git_tree *preimage,
git_diff *diff,
const git_apply_options *options);
+/** Possible application locations for git_apply */
typedef enum {
/**
* Apply the patch to the workdir, leaving the index untouched.
* This is the equivalent of `git apply` with no location argument.
*/