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

Re: Q: rational for $XDG_CONFIG_HOME/git/config to be "non global" or just a bug?

From
Jeff King <peff@peff.net>
Date
Dec 18, 2017, 06:40 UTC
Message-ID
<20171218064042.GA25733@sigill.intra.peff.net>
In-Reply-To
<CA+P7+xpFyD0zuOz7XSCc6cV1T1zu6j-gZD=EMQs-t2WPxi1EMA@mail.gmail.com>
On Sun, Dec 17, 2017 at 08:03:41PM -0800, Jacob Keller wrote:
Show 7 quoted lines
> I do find it a bit weird that --global writes to one of either file,
> and doesn't read from both. I'd rather have --global "only" be
> .gitconfig, and instead add a new option for handling XDG file, and
> then have it such that it reads them in system -> xdg ->
> home/.gitconfig -> local, which allows for local .gitconfig to
> override XDG config, but logically treat them just like we do any
> other files.

I find it weird, too, but I'm not sure that's the right direction. It means that users have to start caring about using "--xdg" instead of "--global" if that's what they want to write to. The original idea was that the transition to xdg should be fairly seamless, and that --global would be an abstraction over both.

To complete that abstraction it seems like reading via "--global" should read from both (in the same precedence order that normal config lookup uses). If you only use one, there wouldn't be any change in behavior. And if you use both, then the behavior makes sense as a subset of the normal config lookup. I.e., it could even be explained as:

  If you give no "source", normal config lookup is similar to checking
  "--system", then "--global", then "--local".

The only person who might be affected is somebody who carries both files _and_ really wanted "--global" to read from one specific file (though I have no idea from which without looking at the source, and from reading this thread it seems I am not the only one who would be confused). So I'd be OK calling that an unintended and unsupported behavior, and the right thing all along should have been to use "--file=" if you really want to avoid "--global" automagic.

-Peff
Previous: Jacob KellerNext: Yaroslav Halchenko
Message 12 of 15 in “Q: rational for $XDG_CONFIG_HOME/git/config to be "non global" or just a bug?”
  1. Yaroslav HalchenkoDec 11, 2017
  2. Jonathan NiederDec 11, 2017
  3. Yaroslav HalchenkoDec 12, 2017
  4. Junio C HamanoDec 12, 2017
  5. Jacob KellerDec 12, 2017
  6. Junio C HamanoDec 12, 2017
  7. Jacob KellerDec 13, 2017
  8. Yaroslav HalchenkoDec 12, 2017
  9. Jacob KellerDec 13, 2017
  10. brian m. carlsonDec 16, 2017
  11. Jacob KellerDec 18, 2017
  12. Jeff KingDec 18, 2017
  13. Yaroslav HalchenkoDec 18, 2017
  14. Junio C HamanoDec 18, 2017
  15. Jacob KellerDec 18, 2017

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.