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

Re: git-config: case insensitivity for subsections

From
Jeff King <peff@peff.net>
Date
Aug 25, 2011, 20:58 UTC
Message-ID
<20110825205849.GA10384@sigill.intra.peff.net>
In-Reply-To
<20110818063528.GH13342@hal.rescomp.berkeley.edu>
On Wed, Aug 17, 2011 at 11:35:28PM -0700, milki wrote:
> If I define [section.SUBSECTION] (aka, not all lowercase), I cannot
> use: git config section.SUBSECTION.option, but rather only git config
> section.subsection.option.

The way the config code works (both internally and via git-config), is to read through the config files, convert each key into a canonical format (downcasing the section and key, and either preserving the case for the subsection in '[section "FOO"]' or downcasing it for '[section.FOO]'), and then compare the result to the canonical version of what you're looking for.

In other words, if you want to match section.SUBSECTION, you should always ask for the canonical version "section.subsection.whatever".

We could try to be nicer and handle this automatically, but it's nontrivial. When you say "git config foo.BAR.baz", we don't know if you mean for "BAR" to be case-insensitive or not. So it would involve carrying more information around about how the section header in the config file was actually parsed. Not impossible, but it would involve changing the internal git_config interface and tweaking a lot of code to match.

Is there a reason that you can't use the canonical version in your "git config" invocation? Or was it simply confusing that it didn't work? I'd much prefer to document this limitation in git-config(1) than change the code.

> Furthermore, If I also define a [section "SUBSECTION"], the two
> sections are not merged.
I'm not sure it makes sense to do so. I can see how:
  [section.SUBSECTION]
and
  [section.subsection]
should be merged. But isn't:
  [section "SUBSECTION"]
conceptually a different section entirely?
Again, do you have a real-world use for this?
-Peff
Previous: milkiNext: Junio C Hamano
Message 2 of 9 in “git-config: case insensitivity for subsections”
  1. milkiAug 18, 2011
  2. Jeff KingAug 25, 2011
  3. Junio C HamanoAug 25, 2011
  4. Jeff KingAug 25, 2011
  5. milkiAug 25, 2011
  6. Alex VandiverAug 29, 2011
  7. milkiAug 29, 2011
  8. Jeff KingAug 29, 2011
  9. Alex VandiverAug 29, 2011

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.