init: kill set_git_dir_init()
[gitweb.git] / ident.c
diff --git a/ident.c b/ident.c
index b2521ffc01fe84950d0646860a274bb8e3e6ccdc..4fd82d104365c2e2c1ab7e1597e7e246c8eded24 100644 (file)
--- a/ident.c
+++ b/ident.c
@@ -79,7 +79,7 @@ static int add_mailname_host(struct strbuf *buf)
                                strerror(errno));
                return -1;
        }
-       if (strbuf_getline(&mailnamebuf, mailname, '\n') == EOF) {
+       if (strbuf_getline(&mailnamebuf, mailname) == EOF) {
                if (ferror(mailname))
                        warning("cannot read /etc/mailname: %s",
                                strerror(errno));
@@ -352,8 +352,10 @@ const char *fmt_ident(const char *name, const char *email,
                int using_default = 0;
                if (!name) {
                        if (strict && ident_use_config_only
-                           && !(ident_config_given & IDENT_NAME_GIVEN))
-                               die("user.useConfigOnly set but no name given");
+                           && !(ident_config_given & IDENT_NAME_GIVEN)) {
+                               fputs(env_hint, stderr);
+                               die("no name was given and auto-detection is disabled");
+                       }
                        name = ident_default_name();
                        using_default = 1;
                        if (strict && default_name_is_bogus) {
@@ -375,8 +377,10 @@ const char *fmt_ident(const char *name, const char *email,
 
        if (!email) {
                if (strict && ident_use_config_only
-                   && !(ident_config_given & IDENT_MAIL_GIVEN))
-                       die("user.useConfigOnly set but no mail given");
+                   && !(ident_config_given & IDENT_MAIL_GIVEN)) {
+                       fputs(env_hint, stderr);
+                       die("no email was given and auto-detection is disabled");
+               }
                email = ident_default_email();
                if (strict && default_email_is_bogus) {
                        fputs(env_hint, stderr);