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

Re: [RFC] ident: support per-path configs by matching the path against a pattern

From
Jeff King <peff@peff.net>
Date
Jul 10, 2015, 15:43 UTC
Message-ID
<20150710154308.GA29395@peff.net>
In-Reply-To
<xmqqr3ogkpz5.fsf@gitster.dls.corp.google.com>
On Fri, Jul 10, 2015 at 08:10:54AM -0700, Junio C Hamano wrote:
Show 19 quoted lines
> I do agree it is a good feature to have to allow you to keep a
> centralized registry of possible configuration in a single place,
> e.g. $HOME/.gitconfig, and selectively apply pieces for multiple
> places.
> 
> Having said that, a few comments.
> 
>  - It feels very hacky to only do this for the ident.  You would
>    want to have, (conceptually, not necessarily at the syntax level)
>    something more along the lines of:
> 
>    	if path matches this pattern
>         	[user]
>                 	email = address
>                         name = name
> 	end
> 
>    to allow any configuration to be covered by this new "selectively
>    use from the centralized registry" feature.

Yeah, I agree it would be nice to cover all config keys. Since it's syntactically difficult to add conditionals to the existing config format, I tried to leave open a space for this in the "include" design. That is, right now:

  [include]
  path = foo
will unconditionally include "foo". But something like:
  [include "gitdir:bar"]
  path = foo

could do so only when the "gitdir:bar" conditional is satisfied (where that is just a syntax I made up to mean fnmatch("bar", $GIT_DIR)). So like user.<pattern>.*, we still put our section-specific hack into one special section, but that one place is capable of chaining to multiple other config keys. :)

My only request is that any conditional we add have some prefix (like "gitdir:") so that we have space to add more types later if we choose.

There's discussion on this topic somewhere on the list, but I didn't bother to dig it up. I don't think it adds anything over what I summarized above.

-Peff
Previous: Junio C HamanoNext: Jeff King
Message 3 of 7 in “[RFC] ident: support per-path configs by matching the path against a pattern”
  1. Sebastian SchuberthJul 10, 2015
  2. Junio C HamanoJul 10, 2015
  3. Jeff KingJul 10, 2015
  4. Jeff KingJul 10, 2015
  5. Junio C HamanoJul 10, 2015
  6. Jeff KingJul 10, 2015
  7. Junio C HamanoJul 10, 2015

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.