summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2019-09-14 14:03:36 -0400
committerDrew DeVault <sir@cmpwn.com>2019-10-22 10:23:24 -0400
commit02af1fcb69b91b3532b8b253ec82cdfce17ef28d (patch)
tree00474513405140855a4f78a5fb7fceed4d8e8907 /include
parentb246bed5ab83035d8aef95f1b7ff10dd746db7cb (diff)
downloadlibgit2-02af1fcb69b91b3532b8b253ec82cdfce17ef28d.tar.gz
apply: add GIT_APPLY_CHECK
This adds an option which will check if a diff is applicable without actually applying it; equivalent to git apply --check.
Diffstat (limited to 'include')
-rw-r--r--include/git2/apply.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/include/git2/apply.h b/include/git2/apply.h
index 94bac1fe7..b248eaafe 100644
--- a/include/git2/apply.h
+++ b/include/git2/apply.h
@@ -53,6 +53,15 @@ 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
*
@@ -72,6 +81,9 @@ typedef struct {
/** 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