From: Junio C Hamano Date: Mon, 15 Sep 2025 19:09:14 GMT Subject: Re: [PATCH] git: run alias subprocess according to the API Message-ID: In-Reply-To: <20250915180842.GA642496@coredump.intra.peff.net> Jeff King writes: > I'm not sure there _is_ any reason to use a raw "git" instead of > ".git_cmd". The case in upload-pack is _not_ running a git command > directly. It is passing the name of a git command to the hook. So you > end up running: > > /path/to/my/hook git pack-objects ...args... > > So I don't think there is any X or Y, and the rule can just be "you > should use .git_cmd". > ... > That said, I do not think it is particularly important to use .git_cmd; > it really is just prepending "git" to argv. It does also override > .use_shell, but it is nonsense to set both flags in the first place > (which is something we could perhaps flag with a BUG() if we cared to). > But I have no problem with preferring .git_cmd to "git" as a style > preference. Ah, OK. I just was confused by the explanation in the middle that appeared to be saying that they are not truly equivalent. If not, then I am perfectly fine. I would actually prefer to get rid of the .git_cmd member altogether to make it simpler to code. The run_command() function should be able to internally decide to short-circuit and invoke "git" directly without the shell by looking at the first element of the argv[] array, One less thing for human programmers to worry about.