libgit2

git_filter_list_apply_to_data

Version:

Apply filter list to a data buffer.

See git2/buffer.h for background on git_buf objects.

If the in buffer holds data allocated by libgit2 (i.e. in->asize is not zero), then it will be overwritten when applying the filters. If not, then it will be left untouched.

If there are no filters to apply (or filters is NULL), then the out buffer will reference the in buffer data (with asize set to zero) instead of allocating data. This keeps allocations to a minimum, but it means you have to be careful about freeing the in data since out may be pointing to it!

Signature

int git_filter_list_apply_to_data(git_buf *out, git_filter_list *filters, git_buf *in);

Parameters

In
out

Buffer to store the result of the filtering

In
filters

A loaded git_filter_list (or NULL)

In
in

Buffer containing the data to filter

Returns

int

0 on success, an error code otherwise

Versions