Sebastian Schuberth <[email protected]> writes:
> Support per-path identities by configuring Git like
>
> $ git config user.<pattern>.email <email address>
>
> e.g.
>
> $ git config user.github.email [email protected]
>
> 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.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html