Re: [RFC/WIP PATCH 08/11] transport: connect_setup appends protocol version number
- From
Eric Sunshine <sunshine@sunshineco.com>
- Date
- May 27, 2015, 03:33 UTC
- Message-ID
- <CAPig+cQAYKH-3Kr4h+Mhag0J8XC+9qDPfyLZD9FfTXOYmUuDLQ@mail.gmail.com>
- In-Reply-To
- <1432677675-5118-9-git-send-email-sbeller@google.com>
On Tue, May 26, 2015 at 6:01 PM, Stefan Beller <sbeller@google.com> wrote:
Show 12 quoted lines
> Signed-off-by: Stefan Beller <sbeller@google.com>
> ---
> diff --git a/transport.c b/transport.c
> index 3ef15f6..33644a6 100644
> --- a/transport.c
> +++ b/transport.c
> @@ -496,15 +496,29 @@ static int set_git_option(struct git_transport_options *opts,
> static int connect_setup(struct transport *transport, int for_push, int verbose)
> {
> struct git_transport_data *data = transport->data;
> + const char *remote_program;
> + char *buf = 0;Naming this 'to_free' would make its purpose more obvious[1], and be more consistent with code elsewhere in the project.
[1]: http://article.gmane.org/gmane.comp.version-control.git/256125/
Show 27 quoted lines
> if (data->conn)
> return 0;
>
> + remote_program = (for_push ? data->options.receivepack
> + : data->options.uploadpack);
> +
> + if (transport->smart_options
> + && transport->smart_options->transport_version) {
> + buf = xmalloc(strlen(remote_program) + 12);
> + sprintf(buf, "%s-%d", remote_program,
> + transport->smart_options->transport_version);
> + remote_program = buf;
> + }
> +
> data->conn = git_connect(data->fd, transport->url,
> - for_push ? data->options.receivepack :
> - data->options.uploadpack,
> + remote_program,
> verbose ? CONNECT_VERBOSE : 0);
>
> + free(buf);
> +
> return 0;
> }
>
> --
> 2.4.1.345.gab207b6.dirty