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
GTGreg Troxel <gdt@ir.bbn.com>
Date
Aug 8, 2013, 15:47 UTC
Message-ID
<rmieha46v6b.fsf@fnord.ir.bbn.com>
In-Reply-To
<vpq1u64dx63.fsf@anie.imag.fr>
Matthieu Moy <Matthieu.Moy@grenoble-inp.fr> writes:
Show 11 quoted lines
> 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.
For what it's worth, I
  keep dotfiles checked in as m4 sources, which is more or less
  equivalent to Matthieu's suggestion of sed
  don't try to keep .gitconfig under source control, but instead have a
  "git-config" alias that executes a lot of "git config --global"
  commands.
The downsides to the git-config shell function approach are:
  unwanted configurations are not removed
  one has to source (e.g.) .bash_aliases and then rerun git-config after
  updating the dotfile repo,

I suspect what's really needed is some sort of two-way macro preprocessor that can take changes in an output file an back them into the source.

Previous: Matthieu MoyNext: Jonathan Nieder
Message 3 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.