ident: reject bogus email addresses with IDENT_STRICT

If we come up with a hostname like "foo.(none)" because the user's machine is not fully qualified, we should reject this in strict mode (e.g., when we are making a commit object), just as we reject an empty gecos username. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Jeff King committed May 24, 2012 at 19:32 UTC 8c5b1ae1b26a7512eb29e75391b8b24c0d0439e7
1 file changed +6
ident.c
+6
@@ -288,6 +288,12 @@ const char *fmt_ident(const char *name, const char *email,
288 name = pw->pw_name;
289 }
290
291 + if (strict && email == git_default_email.buf &&
292 + strstr(email, "(none)")) {
293 + fputs(env_hint, stderr);
294 + die("unable to auto-detect email address (got '%s')", email);
295 + }
296 +
297 if (want_date) {
298 if (date_str && date_str[0]) {
299 if (parse_date(date_str, date, sizeof(date)) < 0)