Re: [PATCH 2/2] push -s: skeleton
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Sep 7, 2011, 22:21 UTC
- Message-ID
- <7vpqjc0zaf.fsf@alter.siamese.dyndns.org>
- In-Reply-To
- <CAJo=hJtz6fa4XfC-4ghryP_nfg3sbcrE2bKauj+F7w2Z_8Ckvw@mail.gmail.com>
Shawn Pearce <spearce@spearce.org> writes:
> Yes. Above we flushed the req_buf and send that in an HTTP request. > You need to hoist this block above the "if (args->stateless_rpc)" > segment.
What do you mean by "hoist"? For the req advertisement, it seems that you are not hoisting anything but duplicating the code, turning safe_write() followed by flush into packet-buf-flush and sending the result over the sideband. Shouldn't this new data be sent over the sideband-to-http the same way?
Unless you do not want signed push over http, that is...
builtin/send-pack.c | 10 +++++++--- 1 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/builtin/send-pack.c b/builtin/send-pack.c index 3193f34..37e0313 100644 --- a/builtin/send-pack.c +++ b/builtin/send-pack.c @@ -379,9 +379,13 @@ int send_pack(struct send_pack_args *args, packet_buf_write(&req_buf, "%.*s", (int)(ep - cp), cp); } - /* Do we need anything funky for stateless rpc? */ - safe_write(out, req_buf.buf, req_buf.len); - packet_flush(out); + if (args->stateless_rpc) { + packet_buf_flush(&req_buf); + send_sideband(out, -1, req_buf.buf, req_buf.len, LARGE_PACKET_MAX); + } else { + safe_write(out, req_buf.buf, req_buf.len); + packet_flush(out); + } } strbuf_release(&req_buf);