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

Re: Multiple --global config workspaces?

From
EHElsie Hupp <git@elsiehupp.com>
Date
Oct 20, 2022, 02:29 UTC
Message-ID
<90F9456A-6ABC-4555-8127-FF2DB0449EF1@elsiehupp.com>
In-Reply-To
<Y08SRgwIvDcsWF0Z@coredump.intra.peff.net>
Show 7 quoted lines
> The expansion of the glob is done by the shell. But it is "cat" which is
> happy to receive multiple files as input. But many other commands are
> not, and include.path is not.
> 
> None of which is to say you're wrong to think of it this way. It's a
> perfectly valid mental model. It just happens not to be the mental model
> we used when implementing it.
The only reason I thought of trying it in the first place is that while reading the git-config documentation, I saw that [include]:gitdir uses implicit globbing:
https://git-scm.com/docs/git-config#Documentation/git-config.txt-codegitdircode
> • If the pattern does not start with either ~/, ./ or /, **/ will be automatically prepended. For example, the pattern foo/bar becomes **/foo/bar and would match /any/path/to/foo/bar.
> • If the pattern ends with /, ** will be automatically added. For example, the pattern foo/ becomes foo/**. In other words, it matches "foo" and everything inside, recursively.
Like literally I did not think to try the wildcard characters with [include] until the mentions of [include]:gitdir, [include]:onbranch, and [include]:hasconfig:remote.*.url suggested it to me.
Admittedly, the examples here are for *implicit* glowing, rather than *explicit* globbing, but this support in one way or another does create a stronger proximate case for consistency than cat does.
>  1. I'd be more convinced by a concrete use case. It sounds like
>     conditional includes were the real sticking point for yours. Maybe
>     somebody wants to do include.path on ".gitconfig.d/*" or something?
>     I dunno.
Basically what I would like as a concrete example is the ability to specify the path, e.g., ~/Repositories/github/.gitconfig without having to specify the name “Repositories”, as other users might prefer, e.g., ~/Projects/github/.gitconfig instead.
Show 9 quoted lines
>> I don’t know off the top of my head what happens when a single
>> variable is defined multiple times. I do get the following output,
>> though:
> 
> It depends on the variable. Most single-value options in Git are "last
> one wins", but some are lists (e.g., remote.*.fetch). We also hold
> config values for other porcelain scripts whose semantics we may not
> even know ourselves. There are options to "git config" for specifying
> how to handle these (e.g., --get-all).
I mean this is where the desired behavior would have to be defined. From my somewhat ignorant position, “last one wins” does seem reasonable in the case of, say, user.email.
> if somebody wants to go to the trouble to implement
Yeah this somebody is almost certainly not going to be me, considering my complete and utter unfamiliarity with the codebase, among other things. 😬
As for proceeding, I think what I can do personally is submit a draft pull request to the Git Book repository with instructions for how to accomplish my own use case as well as, say, the personal/school/work use case with the functionality that already exists, and then based on how that goes things could go from there…?

Best, Elsie

Previous: Jeff KingNext: Elsie Hupp
Message 11 of 14 in “Multiple --global config workspaces?”
  1. Elsie HuppOct 11, 2022
  2. Junio C HamanoOct 11, 2022
  3. Jeff KingOct 11, 2022
  4. Elsie HuppOct 11, 2022
  5. Elsie HuppOct 11, 2022
  6. Jeff KingOct 14, 2022
  7. Matthias AßhauerOct 15, 2022
  8. Jeff KingOct 15, 2022
  9. Elsie HuppOct 18, 2022
  10. Jeff KingOct 18, 2022
  11. Elsie HuppOct 20, 2022
  12. Elsie HuppOct 20, 2022
  13. Philip OakleyOct 11, 2022
  14. RetoOct 11, 2022

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.