Re: [PATCH 06/14] remote.h: add get_remote_capabilities, request_capabilities
- From
David Turner <dturner@twopensource.com>
- Date
- May 2, 2016, 18:57 UTC
- Message-ID
- <1462215463.4123.70.camel@twopensource.com>
- In-Reply-To
- <1461972887-22100-7-git-send-email-sbeller@google.com>
On Fri, 2016-04-29 at 16:34 -0700, Stefan Beller wrote:
Show 14 quoted lines
> +const char *known_capabilities[] = {
> + "multi_ack",
> + "thin-pack",
> + "side-band",
> + "side-band-64k",
> + "ofs-delta",
> + "shallow",
> + "no-progress",
> + "include-tag",
> + "multi_ack_detailed",
> + "allow-tip-sha1-in-want",
> + "allow-reachable-sha1-in-want",
> + "no-done",
> +};I wonder if it is possible to not repeat the list from upload-pack.c? It seems unfortunate to have to add the same string in two places whenever you add a capability.
> +static int keep_capability(char *line)
s/keep_/is_known_/ ? Also it would be good to handle capabilities that are prefixes of others correctly.
Show 9 quoted lines
> +{
> + int i;
> + for (i = 0; i < ARRAY_SIZE(known_capabilities); i++)
> + if (starts_with(line, known_capabilities[i]))
> + return 1;
> + return 0;
> +}
> +
> +void get_remote_capabilities(int in, char *src_buf, size_t src_len)maybe rename "in" to "fd" or "in_fd"? I don't immediately know what "in" is supposed to be when I just look at this signature.
> +void request_capabilities(int out, struct string_list *list)
Maybe name this "send_capabilities_request"?