filter: use streaming filters in tests
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89
diff --git a/tests/filter/custom_helpers.c b/tests/filter/custom_helpers.c
index 233ba32..ee3b635 100644
--- a/tests/filter/custom_helpers.c
+++ b/tests/filter/custom_helpers.c
@@ -37,6 +37,17 @@ int bitflip_filter_apply(
return 0;
}
+static int bitflip_filter_stream(
+ git_writestream **out,
+ git_filter *self,
+ void **payload,
+ const git_filter_source *src,
+ git_writestream *next)
+{
+ return git_filter_buffered_stream_new(out,
+ self, bitflip_filter_apply, NULL, payload, src, next);
+}
+
static void bitflip_filter_free(git_filter *f)
{
git__free(f);
@@ -50,7 +61,7 @@ git_filter *create_bitflip_filter(void)
filter->version = GIT_FILTER_VERSION;
filter->attributes = "+bitflip";
filter->shutdown = bitflip_filter_free;
- filter->apply = bitflip_filter_apply;
+ filter->stream = bitflip_filter_stream;
return filter;
}
@@ -88,6 +99,17 @@ int reverse_filter_apply(
return 0;
}
+static int reverse_filter_stream(
+ git_writestream **out,
+ git_filter *self,
+ void **payload,
+ const git_filter_source *src,
+ git_writestream *next)
+{
+ return git_filter_buffered_stream_new(out,
+ self, reverse_filter_apply, NULL, payload, src, next);
+}
+
static void reverse_filter_free(git_filter *f)
{
git__free(f);
@@ -101,7 +123,7 @@ git_filter *create_reverse_filter(const char *attrs)
filter->version = GIT_FILTER_VERSION;
filter->attributes = attrs;
filter->shutdown = reverse_filter_free;
- filter->apply = reverse_filter_apply;
+ filter->stream = reverse_filter_stream;
return filter;
}
diff --git a/tests/filter/wildcard.c b/tests/filter/wildcard.c
index ca1ba1a..0c9c13b 100644
--- a/tests/filter/wildcard.c
+++ b/tests/filter/wildcard.c
@@ -93,6 +93,17 @@ static int wildcard_filter_apply(
return GIT_PASSTHROUGH;
}
+static int wildcard_filter_stream(
+ git_writestream **out,
+ git_filter *self,
+ void **payload,
+ const git_filter_source *src,
+ git_writestream *next)
+{
+ return git_filter_buffered_stream_new(out,
+ self, wildcard_filter_apply, NULL, payload, src, next);
+}
+
static void wildcard_filter_cleanup(git_filter *self, void *payload)
{
GIT_UNUSED(self);
@@ -112,7 +123,7 @@ static git_filter *create_wildcard_filter(void)
filter->version = GIT_FILTER_VERSION;
filter->attributes = "filter=*";
filter->check = wildcard_filter_check;
- filter->apply = wildcard_filter_apply;
+ filter->stream = wildcard_filter_stream;
filter->cleanup = wildcard_filter_cleanup;
filter->shutdown = wildcard_filter_free;