Call legacy_write_fn if given
diff --git a/src/libgit2/filter.c b/src/libgit2/filter.c
index 20b2157..e2a927e 100644
--- a/src/libgit2/filter.c
+++ b/src/libgit2/filter.c
@@ -902,6 +902,16 @@ static int buffered_stream_close(git_writestream *s)
GIT_ASSERT_ARG(buffered_stream);
+#ifndef GIT_DEPRECATE_HARD
+ if(buffered_stream->write_fn == NULL) {
+ error = buffered_stream->legacy_write_fn(
+ buffered_stream->filter,
+ buffered_stream->payload,
+ (git_buf *)buffered_stream->output,
+ (git_buf *)&buffered_stream->input,
+ buffered_stream->source);
+ } else
+#endif
error = buffered_stream->write_fn(
buffered_stream->filter,
buffered_stream->payload,