git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Syntax for specifying a command in git config

From
Jeff King <peff@peff.net>
Date
May 11, 2021, 18:17 UTC
Message-ID
<YJrKJAa45mNIL+rf@coredump.intra.peff.net>
In-Reply-To
<YJrH8uqzapnpNEsb@gpanders.com>
On Tue, May 11, 2021 at 12:07:46PM -0600, Gregory Anders wrote:
Show 24 quoted lines
> Certain git config parameters (notably sendemail.smtpServer) expect an
> absolute path in order to use a command. If the value begins with a / git
> interprets it as a command; otherwise, it's interpreted it as a server
> hostname.
> 
> Using an absolute path is not very portable, however. If I want to have a
> common shared config file across multiple machines, each of which uses a
> command for smtpServer (e.g. msmtp) but installed at different locations, I
> have to modify the config file on each machine to update the absolute path.
> 
> Obviously this is not a *huge* deal, but it is a minor annoyance. I'm
> wondering if it would be possible to add a new syntax to config options like
> this. For example,
> 
>     [sendemail]
>             smtpServer = !msmtp
> 
> The leading ! character says "the following value is a command that should
> be looked up in PATH". This is congruent with alias definitions, where the
> leading ! means to run the following value as a command directly instead of
> as a git subcommand.
> 
> This also is unambiguous since server hostnames will never begin with a !
> character.

IMHO this is a good path forward. There's a thread from a few months ago which talks about this idea:

  https://lore.kernel.org/git/YCvotU6KVruFuf9%2F@coredump.intra.peff.net/

There's some back and forth, and I'm not sure if I convinced Junio in the end. But certainly a patch would be a good way to restart the conversation. :)

-Peff
Previous: Gregory AndersNext: Junio C Hamano
Message 2 of 5 in “Syntax for specifying a command in git config”
  1. Gregory AndersMay 11, 2021
  2. Jeff KingMay 11, 2021
  3. Junio C HamanoMay 11, 2021
  4. Jeff KingMay 12, 2021
  5. Junio C HamanoMay 12, 2021

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.