send-pack: unbreak push over stateless rpc
[gitweb.git] / builtin-send-pack.c
index 651628871176e5d7569659aafc5b5d262c3f1987..3e70795ef92d4cf6173e869707848bfb0fc884eb 100644 (file)
@@ -97,7 +97,6 @@ static int pack_objects(int fd, struct ref *refs, struct extra_have_objects *ext
                free(buf);
                close(po.out);
                po.out = -1;
-               close(fd);
        }
 
        if (finish_command(&po))
@@ -519,6 +518,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;