Re: [RFCv2 11/16] remote: have preselect_capabilities

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

 



Stefan Beller <sbeller@xxxxxxxxxx> writes:

> Signed-off-by: Stefan Beller <sbeller@xxxxxxxxxx>
> ---

Why?

When adding a new thing that nobody uses yet, please explain what it
is used for and how it would help the callers in what way to help
reviewers.

>  connect.c | 28 ++++++++++++++++++++++++++++
>  remote.h  |  1 +
>  2 files changed, 29 insertions(+)
>
> diff --git a/connect.c b/connect.c
> index 4ebe1dc..752b9a5 100644
> --- a/connect.c
> +++ b/connect.c
> @@ -126,6 +126,34 @@ void get_remote_capabilities(int in, char *src_buf, size_t src_len)
>  	}
>  }
>  
> +/* just select all options the server advertised. */
> +void preselect_capabilities(struct transport_options *options)
> +{
> +	if (is_repository_shallow() && !server_supports("shallow"))
> +		die("Server does not support shallow clients");
> +
> +	if (server_supports("multi_ack"))
> +		options->multi_ack = 1;
> +	else if (server_supports("multi_ack_detailed"))
> +		options->multi_ack = 2;
> +
> +	if (server_supports("side-band"))
> +		options->use_sideband = 1;
> +	else if (server_supports("side-band-64k"))
> +		options->use_sideband = 2;
> +
> +	if (server_supports("no-done"))
> +		options->no_done = 1;
> +	if (server_supports("thin-pack"))
> +		options->use_thin_pack = 1;
> +	if (server_supports("no-progress"))
> +		options->no_progress = 1;
> +	if (server_supports("include-tag"))
> +		options->include_tag = 1;
> +	if (server_supports("ofs-delta"))
> +		options->prefer_ofs_delta = 1;
> +}
> +
>  int request_capabilities(int out, struct transport_options *options)
>  {
>  	if (options->multi_ack == 2)    packet_write(out, "multi_ack_detailed");
> diff --git a/remote.h b/remote.h
> index 61619c5..264a513 100644
> --- a/remote.h
> +++ b/remote.h
> @@ -166,6 +166,7 @@ extern void get_remote_heads(int in, char *src_buf, size_t src_len,
>  			     struct sha1_array *shallow);
>  
>  void get_remote_capabilities(int in, char *src_buf, size_t src_len);
> +void preselect_capabilities(struct transport_options *options);
>  int request_capabilities(int out, struct transport_options*);
>  
>  int resolve_remote_symref(struct ref *ref, struct ref *list);
--
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]