diff options
| author | Edward Thomson <ethomson@edwardthomson.com> | 2021-05-06 15:19:58 +0100 |
|---|---|---|
| committer | Edward Thomson <ethomson@edwardthomson.com> | 2021-05-06 15:19:58 +0100 |
| commit | 26846f4cdbaca7eac5f1030f1c2a25c8b2f8c274 (patch) | |
| tree | f707d3e7c291685f74eab5e4d5ac81e663c4055e /include/git2 | |
| parent | 9869f1e5a30e735d3958c1fed3f6b0979d7f80de (diff) | |
| download | libgit2-26846f4cdbaca7eac5f1030f1c2a25c8b2f8c274.tar.gz | |
filter: remove git_buf sharing in `git_filter_list_apply_to_data`
The API `git_filter_list_apply_to_data` shares data between its out and
in parameters to avoid unnecessarily copying it when there are no
filters to apply. However, it does so in a manner that is potentially
confusing, leaving both `git_buf`s populated with data. This is risky
for end-users who have to know how to deal with this. Instead, we
remove this optimization - users who want to avoid unnecessary copies
can use the longstanding streaming API or check the filter status before
invoking the filters.
Diffstat (limited to 'include/git2')
| -rw-r--r-- | include/git2/filter.h | 12 |
1 files changed, 0 insertions, 12 deletions
diff --git a/include/git2/filter.h b/include/git2/filter.h index 641391b94..45aa6c5af 100644 --- a/include/git2/filter.h +++ b/include/git2/filter.h @@ -122,18 +122,6 @@ GIT_EXTERN(int) git_filter_list_contains( /** * 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! - * * @param out Buffer to store the result of the filtering * @param filters A loaded git_filter_list (or NULL) * @param in Buffer containing the data to filter |
