@@ -886,7 +886,7 @@ static int apply_multi_file_filter(const char *path, const char *src, size_t len
if (fd >= 0)
err = write_packetized_from_fd(fd, process->in);
else
- err = write_packetized_from_buf(src, len, process->in);
+ err = write_packetized_from_buf(src, len, process->in, 1);
if (err)
goto done;
@@ -261,7 +261,8 @@ int write_packetized_from_fd(int fd_in, int fd_out)
return err;
}
-int write_packetized_from_buf(const char *src_in, size_t len, int fd_out)
+int write_packetized_from_buf(const char *src_in, size_t len, int fd_out,
+ int flush_at_end)
{
int err = 0;
size_t bytes_written = 0;
@@ -277,7 +278,7 @@ int write_packetized_from_buf(const char *src_in, size_t len, int fd_out)
err = packet_write_gently(fd_out, src_in + bytes_written, bytes_to_write);
bytes_written += bytes_to_write;
}
- if (!err)
+ if (!err && flush_at_end)
err = packet_flush_gently(fd_out);
return err;
}
@@ -33,7 +33,8 @@ void packet_buf_write_len(struct strbuf *buf, const char *data, size_t len);
int packet_flush_gently(int fd);
int packet_write_fmt_gently(int fd, const char *fmt, ...) __attribute__((format (printf, 2, 3)));
int write_packetized_from_fd(int fd_in, int fd_out);
-int write_packetized_from_buf(const char *src_in, size_t len, int fd_out);
+int write_packetized_from_buf(const char *src_in, size_t len, int fd_out,
+ int flush_at_end);
/*
* Read a packetized line into the buffer, which must be at least size bytes