diff options
| author | Edward Thomson <ethomson@edwardthomson.com> | 2018-07-10 16:10:03 +0100 |
|---|---|---|
| committer | Edward Thomson <ethomson@edwardthomson.com> | 2018-11-05 15:53:59 +0000 |
| commit | af33210b735b760debc03ce558ff62c3834f0a5b (patch) | |
| tree | 23095c9cb3e6024f9dd6c7e939187af187940377 /include/git2 | |
| parent | 37b25ac57f78dc72e6bf4e516e24dc5010098cee (diff) | |
| download | libgit2-af33210b735b760debc03ce558ff62c3834f0a5b.tar.gz | |
apply: introduce a delta callback
Introduce a callback to the application options that allow callers to
add a per-delta callback. The callback can return an error code to stop
patch application, or can return a value to skip the application of a
particular delta.
Diffstat (limited to 'include/git2')
| -rw-r--r-- | include/git2/apply.h | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/include/git2/apply.h b/include/git2/apply.h index cdeb9ed4c..eb9cad4d1 100644 --- a/include/git2/apply.h +++ b/include/git2/apply.h @@ -22,6 +22,22 @@ GIT_BEGIN_DECL /** + * When applying a patch, callback that will be made per delta (file). + * + * When the callback: + * - returns < 0, the apply process will be aborted. + * - returns > 0, the delta will not be applied, but the apply process + * continues + * - returns 0, the delta is applied, and the apply process continues. + * + * @param delta The delta to be applied + * @param payload User-specified payload + */ +typedef int (*git_apply_delta_cb)( + const git_diff_delta *delta, + void *payload); + +/** * Apply options structure * * Initialize with `GIT_APPLY_OPTIONS_INIT`. Alternatively, you can @@ -31,6 +47,9 @@ GIT_BEGIN_DECL */ typedef struct { unsigned int version; + + git_apply_delta_cb delta_cb; + void *payload; } git_apply_options; #define GIT_APPLY_OPTIONS_VERSION 1 |
