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

Re: Feature Request: Support logic or shell execution to control values in .gitconfig

From
Matthieu Moy <matthieu.moy@grenoble-inp.fr>
Date
Aug 8, 2013, 15:23 UTC
Message-ID
<vpq1u64dx63.fsf@anie.imag.fr>
In-Reply-To
<CANY-LFJZazieg-7gLq1=pv=nkED81Gck4=95ffgZ6tGVgX5ffg@mail.gmail.com>
Morgan McClure <mcclure.morgan@gmail.com> writes:
Show 6 quoted lines
> I propose using something reminiscent of bash syntax, either:
> value = $(SOMETEXTTOEXECUTE)
>
> or
>
> value = `SOMETEXTTOEXECUTE`

That would mean executing SOMETEXTTOEXECUTE each time the config file is read. This raises two issues:

* A security issue, as SOMETEXTTOEXECUTE could also be something
  dangerous. It would not be much worse than the current situation (if
  your config file is not trusted, then an attacker could put malicious
  code in core.editor for example), but still increase the security
  risk (as any command reading the config may trigger execution).
* A performance issue with the current git implementation, as the config
  file may be read many time for a single git execution.
> Is this a feature others could get behind?

I think it's unlikely that this ever be implemented. What I suggest instead is to edit/track/share template configuration files like

~/.gitconfig.in email = me@HOSTNAME@

and then script something like sed -e "s/@HOSTNAME@/$(hostname)/" < ~/.gitconfig.in > ~/.gitconfig.

You may also use the include.path functionality to share most of your configuration, and include a small file which is different on each host.

-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/
Previous: Morgan McClureNext: Greg Troxel
Message 2 of 4 in “Feature Request: Support logic or shell execution to control values in .gitconfig”
  1. Morgan McClureAug 8, 2013
  2. Matthieu MoyAug 8, 2013
  3. Greg TroxelAug 8, 2013
  4. Jonathan NiederAug 10, 2013

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.