git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Jeff King <peff@peff.net>
Cc: kristofferhaugsbakk@fastmail.com,  git@vger.kernel.org,
	 Kristoffer Haugsbakk <code@khaugsbakk.name>
Subject: Re: [PATCH] git: run alias subprocess according to the API
Date: Mon, 15 Sep 2025 12:09:14 -0700	[thread overview]
Message-ID: <xmqq7bxzh6sl.fsf@gitster.g> (raw)
In-Reply-To: <20250915180842.GA642496@coredump.intra.peff.net> (Jeff King's message of "Mon, 15 Sep 2025 14:08:42 -0400")

Jeff King <peff@peff.net> 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.




  reply	other threads:[~2025-09-15 19:09 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-14  9:32 [PATCH] git: run alias subprocess according to the API kristofferhaugsbakk
2025-09-15  8:33 ` Junio C Hamano
2025-09-15 18:08   ` Jeff King
2025-09-15 19:09     ` Junio C Hamano [this message]
2025-09-15 19:31       ` Jeff King

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=xmqq7bxzh6sl.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=code@khaugsbakk.name \
    --cc=git@vger.kernel.org \
    --cc=kristofferhaugsbakk@fastmail.com \
    --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;
as well as URLs for NNTP newsgroup(s).