[prev in list] [next in list] [prev in thread] [next in thread]
List: git
Subject: Re: [RFC/PATCH 3/5] connect.c: connect to a remote service with some flags
From: <tboegi () web ! de>
Date: 2015-02-28 11:11:46
Message-ID: 54F1A272.80401 () web ! de
[Download RAW message or body]
On 2015-02-28 02.01, Stefan Beller wrote:
> If this is over git protocol, the flags is appended as the next
> parameter after host=. If it's ssh, a new argument is appended to the
> command line.
>
> None of the callers use this now though.
>
> [sb: originally by pclouds, rebased as jk implemented 1823bea10,
> (git_connect: use argv_array), so any error is mine]
>
> Signed-off-by: Stefan Beller <sbeller@google.com>
> ---
> builtin/fetch-pack.c | 2 +-
> builtin/send-pack.c | 2 +-
> connect.c | 18 ++++++++++++------
> connect.h | 2 +-
> transport.c | 3 ++-
> 5 files changed, 17 insertions(+), 10 deletions(-)
>
[]
> diff --git a/connect.c b/connect.c
> index 062e133..7b6b241 100644
> --- a/connect.c
> +++ b/connect.c
> @@ -650,7 +650,9 @@ static struct child_process no_fork = CHILD_PROCESS_INIT;
> * the connection failed).
> */
> struct child_process *git_connect(int fd[2], const char *url,
> - const char *prog, int flags)
> + const char *prog,
> + const char *service_flags,
The name "service_flags" reminds me on a service:
We connect to a service, but we are not a service.
And "flags" is often used for different bits, collected in an int, but not a "string"
Options are used at the command line, or arguments.
How about "extra_arg", or "extra_option", or "option_str", or simply "options" (or "option") ?
> + int flags)
> {
> char *hostandport, *path;
> struct child_process *conn = &no_fork;
> @@ -685,10 +687,13 @@ struct child_process *git_connect(int fd[2], const char *url,
> * Note: Do not add any other headers here! Doing so
> * will cause older git-daemon servers to crash.
> */
> - packet_write(fd[1],
> - "%s %s%chost=%s%c",
> - prog, path, 0,
> - target_host, 0);
> + if (!service_flags)
> + packet_write(fd[1], "%s %s%chost=%s%c",
> + prog, path, 0, target_host, 0);
> + else
> + packet_write(fd[1], "%s %s%chost=%s%c%s%c",
> + prog, path, 0, target_host, 0,
> + service_flags, 0);
We don't need this "big if" here, a simple "?" will do:
packet_write(fd[1], "%s %s%chost=%s%c%s%c",
prog, path, 0, target_host, 0,
options ? options : "", /* old service_flasgs */
0);
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic