Commit c0dd7122 by Edward Thomson

apply: add an options struct initializer

parent 0b5ba0d7
...@@ -57,7 +57,7 @@ typedef int GIT_CALLBACK(git_apply_hunk_cb)( ...@@ -57,7 +57,7 @@ typedef int GIT_CALLBACK(git_apply_hunk_cb)(
* Apply options structure * Apply options structure
* *
* Initialize with `GIT_APPLY_OPTIONS_INIT`. Alternatively, you can * 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 * @see git_apply_to_tree, git_apply
*/ */
...@@ -72,6 +72,8 @@ typedef struct { ...@@ -72,6 +72,8 @@ typedef struct {
#define GIT_APPLY_OPTIONS_VERSION 1 #define GIT_APPLY_OPTIONS_VERSION 1
#define GIT_APPLY_OPTIONS_INIT {GIT_APPLY_OPTIONS_VERSION} #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 * Apply a `git_diff` to a `git_tree`, and return the resulting image
* as an index. * as an index.
......
...@@ -745,6 +745,13 @@ done: ...@@ -745,6 +745,13 @@ done:
return error; return error;
} }
int git_apply_options_init(git_apply_options *opts, unsigned int version)
{
GIT_INIT_STRUCTURE_FROM_TEMPLATE(
opts, version, git_apply_options, GIT_APPLY_OPTIONS_INIT);
return 0;
}
/* /*
* Handle the three application options ("locations"): * Handle the three application options ("locations"):
* *
......
...@@ -72,6 +72,11 @@ void test_core_structinit__compare(void) ...@@ -72,6 +72,11 @@ void test_core_structinit__compare(void)
clar__skip(); clar__skip();
#endif #endif
/* apply */
CHECK_MACRO_FUNC_INIT_EQUAL( \
git_apply_options, GIT_APPLY_OPTIONS_VERSION, \
GIT_APPLY_OPTIONS_INIT, git_apply_options_init);
/* blame */ /* blame */
CHECK_MACRO_FUNC_INIT_EQUAL( \ CHECK_MACRO_FUNC_INIT_EQUAL( \
git_blame_options, GIT_BLAME_OPTIONS_VERSION, \ git_blame_options, GIT_BLAME_OPTIONS_VERSION, \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment