Web lists-archives.com

Re: [RFE] Please add name and email to git credentials

On Fri, Nov 02, 2018 at 09:57:30AM +0100, Nicolas Mailhot wrote:

> Or are you arguing that having two separate mecanisms in git, to match
> config directives to repo urls, is some kind of improvement?

There are already are multiple mechanisms (e.g., http.* config). So that
ship has sailed. ;)

> I didn't create or write or specify the way git credential matches repo
> urls. It already exists within git. If you have a problem with the
> matching logic git credential uses, why are you arguing with me instead
> of taking it up with the maintainers of this logic?

I did create the way git credential matches repo urls. And I do not
think your proposal is a good idea. The credential system is about
interacting with a remote URL, and creating a commit object is a local
operation. That mismatch leaks through when you work with multiple
remotes, since it is not clear which URL we would match against when the
operation does not involve a remote at all.

If you want to have per-repo name/email for creating commits, right now
your option is to have conditional config based on the local filesystem

Elsewhere in this thread[1] Ævar suggested having conditional config
directives based on the presence of a remote. I'm a little hesitant
there because it requires the config parsing to depend on the value of
another key (introducing subtle timing dependencies). But aside from
bizarre corner cases (e.g., including config for remote.* via a
conditional include on the remote.* config), I think it would do what
you want and would be generally useful.

That seems like a more fruitful direction to me.


[1] https://public-inbox.org/git/87wopxj5wr.fsf@xxxxxxxxxxxxxxxxxxx/