git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: Sebastian Schuberth <sschuberth@gmail.com>, git@vger.kernel.org
Subject: Re: [RFC] ident: support per-path configs by matching the path against a pattern
Date: Fri, 10 Jul 2015 11:43:08 -0400	[thread overview]
Message-ID: <20150710154308.GA29395@peff.net> (raw)
In-Reply-To: <xmqqr3ogkpz5.fsf@gitster.dls.corp.google.com>

On Fri, Jul 10, 2015 at 08:10:54AM -0700, Junio C Hamano wrote:

> 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

  reply	other threads:[~2015-07-10 15:43 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-10  9:36 [RFC] ident: support per-path configs by matching the path against a pattern Sebastian Schuberth
2015-07-10 15:10 ` Junio C Hamano
2015-07-10 15:43   ` Jeff King [this message]
2015-07-10 16:46     ` Jeff King
2015-07-10 20:23       ` Junio C Hamano
2015-07-10 20:58         ` Jeff King
2015-07-10 21:07           ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150710154308.GA29395@peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=sschuberth@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).