summaryrefslogtreecommitdiff
path: root/ident.c
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2012-05-24 23:32:37 (GMT)
committerJunio C Hamano <gitster@pobox.com>2012-05-25 03:50:05 (GMT)
commit8c5b1ae1b26a7512eb29e75391b8b24c0d0439e7 (patch)
tree2fc42fae466db557ad30b66045b824b8f0b6c758 /ident.c
parentf9bc573fdaeaf8621008f3f49aaaa64869791691 (diff)
downloadgit-8c5b1ae1b26a7512eb29e75391b8b24c0d0439e7.zip
git-8c5b1ae1b26a7512eb29e75391b8b24c0d0439e7.tar.gz
git-8c5b1ae1b26a7512eb29e75391b8b24c0d0439e7.tar.bz2
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>
Diffstat (limited to 'ident.c')
-rw-r--r--ident.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/ident.c b/ident.c
index c42258f..98852c7 100644
--- a/ident.c
+++ b/ident.c
@@ -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)