Commit c089d5ac by Edward Thomson

filter: use streaming filters in tests

parent f593fa97
...@@ -37,6 +37,17 @@ int bitflip_filter_apply( ...@@ -37,6 +37,17 @@ int bitflip_filter_apply(
return 0; 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) static void bitflip_filter_free(git_filter *f)
{ {
git__free(f); git__free(f);
...@@ -50,7 +61,7 @@ git_filter *create_bitflip_filter(void) ...@@ -50,7 +61,7 @@ git_filter *create_bitflip_filter(void)
filter->version = GIT_FILTER_VERSION; filter->version = GIT_FILTER_VERSION;
filter->attributes = "+bitflip"; filter->attributes = "+bitflip";
filter->shutdown = bitflip_filter_free; filter->shutdown = bitflip_filter_free;
filter->apply = bitflip_filter_apply; filter->stream = bitflip_filter_stream;
return filter; return filter;
} }
...@@ -88,6 +99,17 @@ int reverse_filter_apply( ...@@ -88,6 +99,17 @@ int reverse_filter_apply(
return 0; 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) static void reverse_filter_free(git_filter *f)
{ {
git__free(f); git__free(f);
...@@ -101,7 +123,7 @@ git_filter *create_reverse_filter(const char *attrs) ...@@ -101,7 +123,7 @@ git_filter *create_reverse_filter(const char *attrs)
filter->version = GIT_FILTER_VERSION; filter->version = GIT_FILTER_VERSION;
filter->attributes = attrs; filter->attributes = attrs;
filter->shutdown = reverse_filter_free; filter->shutdown = reverse_filter_free;
filter->apply = reverse_filter_apply; filter->stream = reverse_filter_stream;
return filter; return filter;
} }
......
...@@ -93,6 +93,17 @@ static int wildcard_filter_apply( ...@@ -93,6 +93,17 @@ static int wildcard_filter_apply(
return GIT_PASSTHROUGH; 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) static void wildcard_filter_cleanup(git_filter *self, void *payload)
{ {
GIT_UNUSED(self); GIT_UNUSED(self);
...@@ -112,7 +123,7 @@ static git_filter *create_wildcard_filter(void) ...@@ -112,7 +123,7 @@ static git_filter *create_wildcard_filter(void)
filter->version = GIT_FILTER_VERSION; filter->version = GIT_FILTER_VERSION;
filter->attributes = "filter=*"; filter->attributes = "filter=*";
filter->check = wildcard_filter_check; filter->check = wildcard_filter_check;
filter->apply = wildcard_filter_apply; filter->stream = wildcard_filter_stream;
filter->cleanup = wildcard_filter_cleanup; filter->cleanup = wildcard_filter_cleanup;
filter->shutdown = wildcard_filter_free; filter->shutdown = wildcard_filter_free;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment