Thread (11 messages) flat view 11 messages, 6 authors, 2016-06-15

Re: git should not use a default user.email config value

From: Felipe Contreras <hidden>
Date: 2016-06-15 22:58:23
Subsystem: the rest · Maintainer: Linus Torvalds

Possibly related (same subject, not in this thread)

On Fri, Aug 9, 2013 at 3:00 PM, Thorsten Glaser [off-list ref] wrote:
Jonathan Nieder dixit:
quoted
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.
quoted
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 <redacted>
Date: Tue, 13 Nov 2012 07:33:12 +0100
Subject: [PATCH] ident: don't allow implicit email addresses

Signed-off-by: Felipe Contreras <redacted>
---
 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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help