@@ -127,17 +127,6 @@ GIT_EXTERN(git_filter_mode_t) git_filter_source_mode(const git_filter_source *sr
127
127
*/
128
128
GIT_EXTERN (uint32_t ) git_filter_source_flags (const git_filter_source * src );
129
129
130
- /*
131
- * struct git_filter
132
- *
133
- * The filter lifecycle:
134
- * - initialize - first use of filter
135
- * - shutdown - filter removed/unregistered from system
136
- * - check - considering filter for file
137
- * - apply - apply filter to file contents
138
- * - cleanup - done with file
139
- */
140
-
141
130
/**
142
131
* Initialize callback on filter
143
132
*
@@ -233,31 +222,51 @@ typedef void (*git_filter_cleanup_fn)(
233
222
* To associate extra data with a filter, allocate extra data and put the
234
223
* `git_filter` struct at the start of your data buffer, then cast the
235
224
* `self` pointer to your larger structure when your callback is invoked.
236
- *
237
- * `version` should be set to GIT_FILTER_VERSION
238
- *
239
- * `attributes` is a whitespace-separated list of attribute names to check
240
- * for this filter (e.g. "eol crlf text"). If the attribute name is bare,
241
- * it will be simply loaded and passed to the `check` callback. If it has
242
- * a value (i.e. "name=value"), the attribute must match that value for
243
- * the filter to be applied. The value may be a wildcard (eg, "name=*"),
244
- * in which case the filter will be invoked for any value for the given
245
- * attribute name. See the attribute parameter of the `check` callback
246
- * for the attribute value that was specified.
247
- *
248
- * The `initialize`, `shutdown`, `check`, `apply`, and `cleanup` callbacks
249
- * are all documented above with the respective function pointer typedefs.
250
225
*/
251
226
struct git_filter {
227
+ /** The `version` field should be set to `GIT_FILTER_VERSION`. */
252
228
unsigned int version ;
253
229
230
+ /**
231
+ * A whitespace-separated list of attribute names to check for this
232
+ * filter (e.g. "eol crlf text"). If the attribute name is bare, it
233
+ * will be simply loaded and passed to the `check` callback. If it
234
+ * has a value (i.e. "name=value"), the attribute must match that
235
+ * value for the filter to be applied. The value may be a wildcard
236
+ * (eg, "name=*"), in which case the filter will be invoked for any
237
+ * value for the given attribute name. See the attribute parameter
238
+ * of the `check` callback for the attribute value that was specified.
239
+ */
254
240
const char * attributes ;
255
241
242
+ /** Called when the filter is first used for any file. */
256
243
git_filter_init_fn initialize ;
244
+
245
+ /** Called when the filter is removed or unregistered from the system. */
257
246
git_filter_shutdown_fn shutdown ;
247
+
248
+ /**
249
+ * Called to determine whether the filter should be invoked for a
250
+ * given file. If this function returns `GIT_PASSTHROUGH` then the
251
+ * `apply` function will not be invoked and the contents will be passed
252
+ * through unmodified.
253
+ */
258
254
git_filter_check_fn check ;
255
+
256
+ /**
257
+ * Called to actually apply the filter to file contents. If this
258
+ * function returns `GIT_PASSTHROUGH` then the contents will be passed
259
+ * through unmodified.
260
+ */
259
261
git_filter_apply_fn apply ;
262
+
263
+ /**
264
+ * Called to apply the filter in a streaming manner. If this is not
265
+ * specified then the system will call `apply` with the whole buffer.
266
+ */
260
267
git_filter_stream_fn stream ;
268
+
269
+ /** Called when the system is done filtering for a file. */
261
270
git_filter_cleanup_fn cleanup ;
262
271
};
263
272
0 commit comments