Re: [PATCH 1/3] connect: Rename name to command in connect_git()
- From
Wesley <wesleys@opperschaap.net>
- Date
- Mar 28, 2026, 00:58 UTC
- Message-ID
- <3e9d8d71-9595-4151-8133-300b89b3b7f8@opperschaap.net>
- In-Reply-To
- <20260327213308.GA598533@coredump.intra.peff.net>
On 3/27/26 17:33, Jeff King wrote:
Show 19 quoted lines
> On Thu, Mar 26, 2026 at 07:37:36PM -0400, Wesley Schwengle wrote: > >> connect_git has `char *name' in its signature and it caught me a little >> offguard. I initially thought it was the remote name. But when you look >> closer at the various call sites it is actually a command that is send >> over the wire, eg . `git-receive-pack'. Change the naming makes it >> easier to read the code and understand its intention. > > I agree that "name" is not all that descriptive, but I think there's a > hidden gotcha in the explanation above. This string is _not_ the command > that we send over the wire. That's "prog" in the same function. And the > reason that "name" exists is that it is a stable name for the operation > we are performing, like "git-receive-pack", even if configuration or > command-line parameters (like "--receive-pack=foo") tell us to use a > different command name. > > So probably "op" or "type" is a more accurate description. This > conceptually ought to be an enum, too, since it is selecting from a > limited set of operations we know about.
That's a fair take on it, "name" is really a not the best name for this variable. I think "op" covers what you describe here best, it reflects also why I named it command. When you check what is sent via ssh, it looks like the command:
ssh -o SendEnv=GIT_PROTOCOL git@gitlab.com git-upload-pack 'waterkip/git.git'
That's why in my change it was named command, op, or operation covers it too.
Cheers, Wesley
-- Wesley Why not both?