File tree Expand file tree Collapse file tree 3 files changed +30
-0
lines changed
Expand file tree Collapse file tree 3 files changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -118,6 +118,10 @@ typedef enum {
118118
119119/**
120120 * The options used when applying filter options to a file.
121+ *
122+ * Initialize with `GIT_BLOB_FILTER_OPTIONS_INIT`. Alternatively, you can
123+ * use `git_blob_filter_options_init`.
124+ *
121125 */
122126typedef struct {
123127 int version ;
@@ -129,6 +133,18 @@ typedef struct {
129133#define GIT_BLOB_FILTER_OPTIONS_VERSION 1
130134#define GIT_BLOB_FILTER_OPTIONS_INIT {GIT_BLOB_FILTER_OPTIONS_VERSION, GIT_BLOB_FILTER_CHECK_FOR_BINARY}
131135
136+ /**
137+ * Initialize git_blob_filter_options structure
138+ *
139+ * Initializes a `git_blob_filter_options` with default values. Equivalent
140+ * to creating an instance with `GIT_BLOB_FILTER_OPTIONS_INIT`.
141+ *
142+ * @param opts The `git_blob_filter_options` struct to initialize.
143+ * @param version The struct version; pass `GIT_BLOB_FILTER_OPTIONS_VERSION`.
144+ * @return Zero on success; -1 on failure.
145+ */
146+ GIT_EXTERN (int ) git_blob_filter_options_init (git_blob_filter_options * opts , unsigned int version );
147+
132148/**
133149 * Get a buffer with the filtered content of a blob.
134150 *
Original file line number Diff line number Diff line change @@ -408,6 +408,15 @@ int git_blob_is_binary(const git_blob *blob)
408408 return git_buf_text_is_binary (& content );
409409}
410410
411+ int git_blob_filter_options_init (
412+ git_blob_filter_options * opts ,
413+ unsigned int version )
414+ {
415+ GIT_INIT_STRUCTURE_FROM_TEMPLATE (opts , version ,
416+ git_blob_filter_options , GIT_BLOB_FILTER_OPTIONS_INIT );
417+ return 0 ;
418+ }
419+
411420int git_blob_filter (
412421 git_buf * out ,
413422 git_blob * blob ,
Original file line number Diff line number Diff line change @@ -82,6 +82,11 @@ void test_core_structinit__compare(void)
8282 git_blame_options , GIT_BLAME_OPTIONS_VERSION , \
8383 GIT_BLAME_OPTIONS_INIT , git_blame_options_init );
8484
85+ /* blob_filter_options */
86+ CHECK_MACRO_FUNC_INIT_EQUAL ( \
87+ git_blob_filter_options , GIT_BLOB_FILTER_OPTIONS_VERSION , \
88+ GIT_BLOB_FILTER_OPTIONS_INIT , git_blob_filter_options_init );
89+
8590 /* checkout */
8691 CHECK_MACRO_FUNC_INIT_EQUAL ( \
8792 git_checkout_options , GIT_CHECKOUT_OPTIONS_VERSION , \
You can’t perform that action at this time.
0 commit comments