Re: [RFCv2 09/16] remote.h: add get_remote_capabilities, request_capabilities

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Stefan Beller <sbeller@xxxxxxxxxx> writes:

> 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 which will
> tell the selection of capabilities to the remote.
>
> Signed-off-by: Stefan Beller <sbeller@xxxxxxxxxx>
> ---
>  connect.c | 37 +++++++++++++++++++++++++++++++++++++
>  remote.h  |  3 +++
>  2 files changed, 40 insertions(+)
>
> diff --git a/connect.c b/connect.c
> index a2c777e..4ebe1dc 100644
> --- a/connect.c
> +++ b/connect.c
> @@ -105,6 +105,43 @@ static void annotate_refs_with_symref_info(struct ref *ref)
>  	string_list_clear(&symref, 0);
>  }
>  
> +void get_remote_capabilities(int in, char *src_buf, size_t src_len)

We need to clarify that this is for v2 only in its name, no?

> +{
> +	string_list_clear(&server_capabilities, 1);
> +	for (;;) {
> +		int len;
> +		char *line = packet_buffer;
> +
> +		len = packet_read(in, &src_buf, &src_len,
> +				  packet_buffer, sizeof(packet_buffer),
> +				  PACKET_READ_GENTLE_ON_EOF |
> +				  PACKET_READ_CHOMP_NEWLINE);
> +		if (len < 0)
> +			die_initial_contact(0);
> +
> +		if (!len)
> +			break;

OK, so we get sequence of capabilities, one per packet, until
packet_flush().  I wonder if we want to hint that with:

		if (!len)
			break; /* flush */

or something like that.

> +		string_list_append(&server_capabilities, line);
> +	}
> +}

> +int request_capabilities(int out, struct transport_options *options)
> +{
> +	if (options->multi_ack == 2)    packet_write(out, "multi_ack_detailed");

Spell these just like you would do any other functions, i.e.

	if (options->multi_ack == 2)
        	packet_write(out, "multi_ack_detailed");


I think this step is sensible, and anticipate that a new method that
corresponds to this will be introduced to the transport layer.

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]