Re: git should not use a default user.email config value
On Fri, Aug 9, 2013 at 3:00 PM, Thorsten Glaser <tg@mirbsd.de> wrote:
> Jonathan Nieder dixit:
Show 6 quoted lines
>>I wonder if it's too gentle and long to get the point across. Would
>>something the following (including the guesses in the message for
>>easier copy-pasting) help?
>
> Definitely not. It needs to fail hard if user.email is not set,
> i.e. refuse to accept the commit.
Completely agree, and I argued this point some time ago.
Show 13 quoted lines
>>is set and not set. Git already notices the cases where the guessed
>>email address ends with ".(none)" and errors out, and it could make
>>sense to be more aggressive.
>
> The guessed addresses are like 'denge@pc-bn-041.lan.tarent.de'
> instead of 'd.enge@tarent.de' which is the correct Kolab address
> (this information can be publicly accessed since the project I
> noticed it in is on our public FusionForge instance, so I don’t
> think sharing specifics is bad here, but please don’t hammer our
> poor trainee with spam now). So they’re a “correct” unix username
> at a correct FQDN (which, thanks to split-horizon, even would
> work internally, except there’s of course no MTA set up) and
> won’t be caught by *.(none) matches.
This is how to implement that:
From f1feaa05ce3772d8006078c4aeabcbd55b52d58e Mon Sep 17 00:00:00 2001
From: Felipe Contreras 2nd <felipe.contreras+2@gmail.com>
Date: Tue, 13 Nov 2012 07:33:12 +0100
Subject: [PATCH] ident: don't allow implicit email addresses
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
ident.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/ident.c b/ident.c
index 1c123e6..85fc729 100644
--- a/ident.c
+++ b/ident.c
@@ -301,9 +301,9 @@ const char *fmt_ident(const char *name, const char *email,
}
if (strict && email == git_default_email.buf &&
- strstr(email, "(none)")) {
+ !(user_ident_explicitly_given & IDENT_MAIL_GIVEN)) {
fputs(env_hint, stderr);
- die("unable to auto-detect email address (got '%s')", email);
+ die("no explicit email address");
}
if (want_date) {
--
1.8.3.267.gbb4989f
--
Felipe Contreras