Skip to content

Commit

Permalink
ident: reject bogus email addresses with IDENT_STRICT
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Jeff King authored and Junio C Hamano committed May 25, 2012
1 parent f9bc573 commit 8c5b1ae
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions ident.c
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,12 @@ const char *fmt_ident(const char *name, const char *email,
name = pw->pw_name;
}

if (strict && email == git_default_email.buf &&
strstr(email, "(none)")) {
fputs(env_hint, stderr);
die("unable to auto-detect email address (got '%s')", email);
}

if (want_date) {
if (date_str && date_str[0]) {
if (parse_date(date_str, date, sizeof(date)) < 0)
Expand Down

0 comments on commit 8c5b1ae

Please sign in to comment.