git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: Dan Aloni <alonid@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] Trick to force setup of a specific configured E-Mail per repo
Date: Tue, 2 Feb 2016 22:56:48 -0500	[thread overview]
Message-ID: <20160203035648.GA20732@sigill.intra.peff.net> (raw)
In-Reply-To: <1454442861-4879-1-git-send-email-alonid@gmail.com>

On Tue, Feb 02, 2016 at 09:54:21PM +0200, Dan Aloni wrote:

> Previously, before 5498c57cdd63, many people did the following:
> 
>    git config --global user.email "(none)"
> 
> This was helpful for people with more than one E-Mail address,
> targeting different E-Mail addresses for different clones.
> as it barred git from creating commit unless the user.email
> config was set in the per-clone config to the correct E-Mail
> address.
> 
> Now, since the original 'bug' was fixed, and practically every
> string is acceptable for user.email and user.name, it is best
> to reimplement the feature not as an exploit of a bug, but as
> an actual feature.

Just when I dare to think "somebody cannot possibly be relying on this
arcane behavior", I am proven wrong. :)

The motivating case for your patch makes sense to me. In the
implementation, though:

> +	if (strict && email && !strcmp(email, "(per-repo)")) {
> +		die("email is '(per-repo)', suggesting to set specific email "
> +		    "for the current repo");
> +	}

I find it disappointing that we go back to looking for magic sequences
in the string. Could we perhaps do this more cleanly with a new config
option? Like a "user.guessIdent" which defaults to true, but people can
set to false. And without that, we do not do any automagic at all; we
get the values from the GIT_COMMITTER_* environment or the
user.{name,email} config variables, or we die().

I think that should allow your use case (and extend the same feature to
user.name). It wouldn't work on older versions of git, but nor would
your fix here (the only way to do that is to re-instate "(none)" as
magical).

-Peff

  reply	other threads:[~2016-02-03  3:56 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-02 19:54 [PATCH] Trick to force setup of a specific configured E-Mail per repo Dan Aloni
2016-02-03  3:56 ` Jeff King [this message]
2016-02-03  5:19   ` Duy Nguyen
2016-02-03  5:22     ` Jeff King
2016-02-03  5:26       ` Duy Nguyen
2016-02-03  5:53         ` Jeff King
2016-02-03  8:01   ` Junio C Hamano
2016-02-03  8:21   ` Dan Aloni
2016-02-03 17:47     ` Eric Sunshine
2016-02-03 19:22       ` [PATCH v3] Add user.explicit boolean for when ident shouldn't be guessed Dan Aloni
2016-02-04  4:01         ` Jeff King
2016-02-04  4:19           ` Jeff King
2016-02-04  4:32             ` Jeff King
2016-02-04  5:36           ` Dan Aloni
2016-02-04  5:50             ` Jeff King
2016-02-04  9:07               ` Dan Aloni

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=20160203035648.GA20732@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=alonid@gmail.com \
    --cc=git@vger.kernel.org \
    /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).