From: Patrick Steinhardt <ps@pks.im>
To: Jeff King <peff@peff.net>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] connect: use "service" enum for "name" argument
Date: Thu, 21 May 2026 10:19:48 +0200 [thread overview]
Message-ID: <ag7AJMbav6KgSCjj@pks.im> (raw)
In-Reply-To: <20260519052219.GA1703179@coredump.intra.peff.net>
On Tue, May 19, 2026 at 01:22:19AM -0400, Jeff King wrote:
> diff --git a/connect.h b/connect.h
> index 1645126c17..c56ecddc0e 100644
> --- a/connect.h
> +++ b/connect.h
> @@ -7,7 +7,12 @@
> #define CONNECT_DIAG_URL (1u << 1)
> #define CONNECT_IPV4 (1u << 2)
> #define CONNECT_IPV6 (1u << 3)
> -struct child_process *git_connect(int fd[2], const char *url, const char *name, const char *prog, int flags);
> +enum git_connect_service {
> + GIT_CONNECT_UPLOAD_PACK,
> + GIT_CONNECT_RECEIVE_PACK,
> + GIT_CONNECT_UPLOAD_ARCHIVE,
> +};
> +struct child_process *git_connect(int fd[2], const char *url, enum git_connect_service, const char *prog, int flags);
> int finish_connect(struct child_process *conn);
> int git_connection_is_socket(struct child_process *conn);
> int server_supports(const char *feature);
This is all quite tightly-packed, and the patch would be a good
opportunity to maybe add some documentation. But that's certainly
moving the goalposts quite a bit.
> diff --git a/transport-helper.c b/transport-helper.c
> index 4614036c99..bf37c5280c 100644
> --- a/transport-helper.c
> +++ b/transport-helper.c
> @@ -620,8 +620,22 @@ static int run_connect(struct transport *transport, struct strbuf *cmdbuf)
> return ret;
> }
>
> +static const char *connect_service_cmd(enum git_connect_service service)
> +{
> + switch (service) {
> + case GIT_CONNECT_UPLOAD_PACK:
> + return "git-upload-pack";
> + case GIT_CONNECT_RECEIVE_PACK:
> + return "git-receive-pack";
> + case GIT_CONNECT_UPLOAD_ARCHIVE:
> + return "git-upload-archive";
> + }
> + BUG("unknown git_connect_type: %d", service);
> +}
Shouldn't this say "unknown git_connect_service" instead of "_type"?
Other than that this patch looks good to me, and I agree that this makes
the argument a bit easier to understand.
Patrick
prev parent reply other threads:[~2026-05-21 8:19 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-19 5:22 [PATCH] connect: use "service" enum for "name" argument Jeff King
2026-05-21 8:19 ` Patrick Steinhardt [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ag7AJMbav6KgSCjj@pks.im \
--to=ps@pks.im \
--cc=git@vger.kernel.org \
--cc=peff@peff.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox