Skip to content

Commit 5309b46

Browse files
committed
filter: introduce git_filter_list_apply_to_buffer
Provide a filter application mechanism that takes a user-provided string and length, instead of a `git_buf`.
1 parent 26846f4 commit 5309b46

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

include/git2/filter.h

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,21 @@ GIT_EXTERN(int) git_filter_list_contains(
119119
git_filter_list *filters,
120120
const char *name);
121121

122+
/**
123+
* Apply filter list to a data buffer.
124+
*
125+
* @param out Buffer to store the result of the filtering
126+
* @param filters A loaded git_filter_list (or NULL)
127+
* @param in Buffer containing the data to filter
128+
* @param in_len The length of the input buffer
129+
* @return 0 on success, an error code otherwise
130+
*/
131+
GIT_EXTERN(int) git_filter_list_apply_to_buffer(
132+
git_buf *out,
133+
git_filter_list *filters,
134+
const char *in,
135+
size_t in_len);
136+
122137
/**
123138
* Apply filter list to a data buffer.
124139
*

src/filter.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -720,7 +720,7 @@ static void buf_stream_init(struct buf_stream *writer, git_buf *target)
720720
git_buf_clear(target);
721721
}
722722

723-
static int git_filter_list_apply_to_buffer(
723+
int git_filter_list_apply_to_buffer(
724724
git_buf *out,
725725
git_filter_list *filters,
726726
const char *in,

0 commit comments

Comments
 (0)