Re: [RFC/WIP PATCH 06/11] remote.h: add get_remote_capabilities, request_capabilities

2015-05-29 Thread Jeff King
On Fri, May 29, 2015 at 12:39:35PM -0700, Stefan Beller wrote: I think this is the reverse case of next_capabilities in the upload-pack side, so I'll make the reverse suggestion. :) Would it make things nicer if both v1 and v2 parsed the capabilities into a string_list? Ok, I'll do that.

Re: [RFC/WIP PATCH 06/11] remote.h: add get_remote_capabilities, request_capabilities

2015-05-29 Thread Stefan Beller
On Tue, May 26, 2015 at 11:45 PM, Jeff King p...@peff.net wrote: On Tue, May 26, 2015 at 03:01:10PM -0700, Stefan Beller wrote: +void get_remote_capabilities(int in, char *src_buf, size_t src_len) +{ + struct strbuf capabilities_string = STRBUF_INIT; + for (;;) { + int

Re: [RFC/WIP PATCH 06/11] remote.h: add get_remote_capabilities, request_capabilities

2015-05-27 Thread Eric Sunshine
On Wed, May 27, 2015 at 2:50 AM, Jeff King p...@peff.net wrote: On Tue, May 26, 2015 at 11:25:05PM -0400, Eric Sunshine wrote: + len = packet_read(in, src_buf, src_len, + packet_buffer, sizeof(packet_buffer), +

Re: [RFC/WIP PATCH 06/11] remote.h: add get_remote_capabilities, request_capabilities

2015-05-27 Thread Jeff King
On Wed, May 27, 2015 at 01:19:39PM -0400, Eric Sunshine wrote: The 'len 4' check is needed because there's no guarantee that 'line' is NUL-terminated. Correct? I think this was just blindly copied from get_remote_heads(). And I think that code was being overly paranoid. Ever since

Re: [RFC/WIP PATCH 06/11] remote.h: add get_remote_capabilities, request_capabilities

2015-05-27 Thread Jeff King
On Tue, May 26, 2015 at 03:01:10PM -0700, Stefan Beller wrote: +void get_remote_capabilities(int in, char *src_buf, size_t src_len) +{ + struct strbuf capabilities_string = STRBUF_INIT; + for (;;) { + int len; + char *line = packet_buffer; +

Re: [RFC/WIP PATCH 06/11] remote.h: add get_remote_capabilities, request_capabilities

2015-05-27 Thread Jeff King
On Tue, May 26, 2015 at 11:25:05PM -0400, Eric Sunshine wrote: + len = packet_read(in, src_buf, src_len, + packet_buffer, sizeof(packet_buffer), + PACKET_READ_GENTLE_ON_EOF | +

Re: [RFC/WIP PATCH 06/11] remote.h: add get_remote_capabilities, request_capabilities

2015-05-26 Thread Eric Sunshine
On Tue, May 26, 2015 at 6:01 PM, Stefan Beller sbel...@google.com wrote: Instead of calling get_remote_heads as a first command during the protocol exchange, we need to have fine grained control over the capability negotiation in version 2 of the protocol. Introduce get_remote_capabilities,

[RFC/WIP PATCH 06/11] remote.h: add get_remote_capabilities, request_capabilities

2015-05-26 Thread Stefan Beller
Instead of calling get_remote_heads as a first command during the protocol exchange, we need to have fine grained control over the capability negotiation in version 2 of the protocol. Introduce get_remote_capabilities, which will just listen to capabilities of the remote and request_capabilities