From: Junio C Hamano <gitster@pobox.com>
To: Sebastian Schuberth <sschuberth@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: [RFC] ident: support per-path configs by matching the path against a pattern
Date: Fri, 10 Jul 2015 08:10:54 -0700 [thread overview]
Message-ID: <xmqqr3ogkpz5.fsf@gitster.dls.corp.google.com> (raw)
In-Reply-To: <0000014e7752e758-a0bf7acb-2d0f-4492-8004-8eeeb9b2f042-000000@eu-west-1.amazonses.com> (Sebastian Schuberth's message of "Fri, 10 Jul 2015 09:36:38 +0000")
Sebastian Schuberth <sschuberth@gmail.com> writes:
> Support per-path identities by configuring Git like
>
> $ git config user.<pattern>.email <email address>
>
> e.g.
>
> $ git config user.github.email sschuberth+github@gmail.com
>
> In this example, the middle "github" pattern is searched for
> case-insensitively in the absolute path name to the current git work tree.
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.
- It is iffy to match the pattern with "working tree". There are
pros and cons but a viable alternative would be to match with the
location of the $GIT_DIR. Given that we now are slowly moving to
a world where a single $GIT_DIR can have multiple working trees,
and that user.name ultimately matters per-project you are
contributing to, it is more likely that you would want to tie it
to a local repository, i.e. $GIT_DIR, no matter where working
trees you have a checkout out of that repository live. They
would want to share the same setting.
On the other hand, some things may be truly per working tree even
if it is tied to the same local repository.
I am not saying it is better to tie this to $GIT_DIR not
$GIT_WORK_TREE. I am not necessarily saying we should support
both. I am only saying that we need to consider if tying only to
$GIT_WORK_TREE makes sense (and if so, clearly communicate that
to the end users). I couldn't read from your patch [*1*] what
your stance on this point.
- The pattern defined to be case-insensitive substring would not be
a sane general design. I would have expected it to be fnmatch
pattern that may match case insensitively only on case insensitive
filesystems.
[Footnote]
*1* this is one of the reasons why I usually ignore "I'll do the doc
and test if people agree it is a good idea." Often, we cannot judge
if it is a good idea without these things.
next prev parent reply other threads:[~2015-07-10 15:11 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 [this message]
2015-07-10 15:43 ` Jeff King
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=xmqqr3ogkpz5.fsf@gitster.dls.corp.google.com \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--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).