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

Re: appending a pattern to the default "diff.cpp.xfuncname"

From
Jeff King <peff@peff.net>
Date
Aug 3, 2016, 18:40 UTC
Message-ID
<20160803184029.kg7xdcb5s7znxyjq@sigill.intra.peff.net>
In-Reply-To
<8c4e96b9-165f-5168-d220-6a1548ff83c7@gmail.com>
On Wed, Aug 03, 2016 at 08:34:28PM +0200, Jakub Narębski wrote:
Show 5 quoted lines
> > Unfortunately, no, the config system has no notion of "append to this
> > value". 
> 
> And I think adding such capability would not be easy.  Well, perhaps
> we could support '+=' in addition to '='?

We could, but it would be an incompatible syntactic change, which we've so far managed to avoid.

Show 5 quoted lines
> >         So you are stuck with extracting the builtin value (which
> > annoyingly, you cannot even get without looking at the source code!),
> > and repeating it in your config file.
> 
> I wonder if `git var -l` could provide all default values :-P

I had a similar thought, but it's quite difficult because of the way that default values are structured in git. Most code uses initialization of C variables (including structs) to set up default values, and then overrides them if it sees relevant config.

So there is no central code to ask "what is the value of X if I don't provide any config"? It literally requires dumping a bunch of variables.

One thing we could do is move all of those defaults into an "internal" config that is baked into the executable, and then parse that at the lowest-priority level of config. And then "git config --list --show-origin" could presumably just dump it.

But that would mean parsing it at run-time in every program (which is probably not _that_ much overhead, but does feel wrong). I'd also suspect there are a few cases whose defaults are expressed in code, rather than as single variable assignments, and couldn't be represented as config at all.

-Peff
Previous: Jakub Narębski
Message 5 of 5 in “appending a pattern to the default "diff.cpp.xfuncname"”
  1. Laszlo ErsekAug 3, 2016
  2. Jeff KingAug 3, 2016
  3. Laszlo ErsekAug 3, 2016
  4. Jakub NarębskiAug 3, 2016
  5. Jeff KingAug 3, 2016

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.