Re: [RFCv2 10/16] transport: connect_setup appends protocol version number
- From
Duy Nguyen <pclouds@gmail.com>
- Date
- Jun 2, 2015, 09:58 UTC
- Message-ID
- <CACsJy8Dped78Db0Pb455-dxha4aaQnSWDN_TwRpe9miVmwHcjg@mail.gmail.com>
- In-Reply-To
- <1433203338-27493-11-git-send-email-sbeller@google.com>
On Tue, Jun 2, 2015 at 7:02 AM, Stefan Beller <sbeller@google.com> wrote:
Show 33 quoted lines
> Signed-off-by: Stefan Beller <sbeller@google.com>
> ---
>
> Notes:
> name it to_free
>
> transport.c | 17 +++++++++++++++--
> 1 file changed, 15 insertions(+), 2 deletions(-)
>
> diff --git a/transport.c b/transport.c
> index 651f0ac..b49fc60 100644
> --- a/transport.c
> +++ b/transport.c
> @@ -496,15 +496,28 @@ 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 *to_free = 0;
>
> if (data->conn)
> return 0;
>
> + remote_program = (for_push ? data->options.receivepack
> + : data->options.uploadpack);
> +
> + if (transport->smart_options->transport_version >= 2) {
> + to_free = xmalloc(strlen(remote_program) + 12);
> + sprintf(to_free, "%s-%d", remote_program,
> + transport->smart_options->transport_version);
> + remote_program = to_free;
> + }
> +It looks to me that the caller should pass "upload-pack-2" here in data->options.uploadpack already. We should not need to manipulate the uploadpack's program name. Not sure how complicated it would be though.
Show 14 quoted lines
> data->conn = git_connect(data->fd, transport->url, > - for_push ? data->options.receivepack : > - data->options.uploadpack, > + remote_program, > verbose ? CONNECT_VERBOSE : 0); > > + free(to_free); > + > return 0; > } > > -- > 2.4.1.345.gab207b6.dirty >
-- Duy