Re: [RFCv2 11/16] remote: have preselect_capabilities
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Jun 2, 2015, 21:45 UTC
- Message-ID
- <xmqqvbf5zsvl.fsf@gitster.dls.corp.google.com>
- In-Reply-To
- <1433203338-27493-12-git-send-email-sbeller@google.com>
Stefan Beller <sbeller@google.com> writes:
> Signed-off-by: Stefan Beller <sbeller@google.com> > ---
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.
Show 55 quoted lines
> 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);