Merge branch 'rr/rerere-libify-clear-gc'
[gitweb.git] / builtin / send-pack.c
index 2cd1c40b70890732905ad9433e452aa9a9548533..4ac2ca984ff36588c68274f10f131ef88023d622 100644 (file)
@@ -1,4 +1,4 @@
-#include "cache.h"
+#include "builtin.h"
 #include "commit.h"
 #include "refs.h"
 #include "pkt-line.h"
@@ -229,6 +229,9 @@ static void print_helper_status(struct ref *ref)
 static int sideband_demux(int in, int out, void *data)
 {
        int *fd = data;
+#ifdef NO_PTHREADS
+       close(fd[1]);
+#endif
        int ret = recv_sideband("send-pack", fd[0], out);
        close(out);
        return ret;
@@ -339,6 +342,8 @@ int send_pack(struct send_pack_args *args,
                if (pack_objects(out, remote_refs, extra_have, args) < 0) {
                        for (ref = remote_refs; ref; ref = ref->next)
                                ref->status = REF_STATUS_NONE;
+                       if (args->stateless_rpc)
+                               close(out);
                        if (use_sideband)
                                finish_async(&demux);
                        return -1;