connect: teach client to recognize v1 server response
[gitweb.git] / pkt-line.c
index 4823d3bb9db002fadf47124184ccea39d66fac68..7006b35879529f5f1a26cb5b6a628fe28aebe6a7 100644 (file)
@@ -136,8 +136,9 @@ static void format_packet(struct strbuf *out, const char *fmt, va_list args)
 static int packet_write_fmt_1(int fd, int gently,
                              const char *fmt, va_list args)
 {
-       struct strbuf buf = STRBUF_INIT;
+       static struct strbuf buf = STRBUF_INIT;
 
+       strbuf_reset(&buf);
        format_packet(&buf, fmt, args);
        if (write_in_full(fd, buf.buf, buf.len) < 0) {
                if (!gently) {
@@ -187,6 +188,12 @@ static int packet_write_gently(const int fd_out, const char *buf, size_t size)
        return 0;
 }
 
+void packet_write(int fd_out, const char *buf, size_t size)
+{
+       if (packet_write_gently(fd_out, buf, size))
+               die_errno("packet write failed");
+}
+
 void packet_buf_write(struct strbuf *buf, const char *fmt, ...)
 {
        va_list args;