completion: put matching ctags symbol names directly into COMPREPLY
[gitweb.git] / ident.c
diff --git a/ident.c b/ident.c
index e20a772dde4230b0871ffe85a5204919402aaf94..ac4ae02b485637002869b3fc7a78033d7a5b6aec 100644 (file)
--- a/ident.c
+++ b/ident.c
@@ -101,7 +101,7 @@ static int canonical_name(const char *host, struct strbuf *out)
        memset (&hints, '\0', sizeof (hints));
        hints.ai_flags = AI_CANONNAME;
        if (!getaddrinfo(host, NULL, &hints, &ai)) {
-               if (ai && strchr(ai->ai_canonname, '.')) {
+               if (ai && ai->ai_canonname && strchr(ai->ai_canonname, '.')) {
                        strbuf_addstr(out, ai->ai_canonname);
                        status = 0;
                }
@@ -331,17 +331,17 @@ int split_ident_line(struct ident_split *split, const char *line, int len)
 }
 
 static const char *env_hint =
-"\n"
-"*** Please tell me who you are.\n"
-"\n"
-"Run\n"
-"\n"
-"  git config --global user.email \"you@example.com\"\n"
-"  git config --global user.name \"Your Name\"\n"
-"\n"
-"to set your account\'s default identity.\n"
-"Omit --global to set the identity only in this repository.\n"
-"\n";
+N_("\n"
+   "*** Please tell me who you are.\n"
+   "\n"
+   "Run\n"
+   "\n"
+   "  git config --global user.email \"you@example.com\"\n"
+   "  git config --global user.name \"Your Name\"\n"
+   "\n"
+   "to set your account\'s default identity.\n"
+   "Omit --global to set the identity only in this repository.\n"
+   "\n");
 
 const char *fmt_ident(const char *name, const char *email,
                      const char *date_str, int flag)
@@ -356,13 +356,13 @@ const char *fmt_ident(const char *name, const char *email,
                if (!name) {
                        if (strict && ident_use_config_only
                            && !(ident_config_given & IDENT_NAME_GIVEN)) {
-                               fputs(env_hint, stderr);
+                               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) {
-                               fputs(env_hint, stderr);
+                               fputs(_(env_hint), stderr);
                                die("unable to auto-detect name (got '%s')", name);
                        }
                }
@@ -370,7 +370,7 @@ const char *fmt_ident(const char *name, const char *email,
                        struct passwd *pw;
                        if (strict) {
                                if (using_default)
-                                       fputs(env_hint, stderr);
+                                       fputs(_(env_hint), stderr);
                                die("empty ident name (for <%s>) not allowed", email);
                        }
                        pw = xgetpwuid_self(NULL);
@@ -381,12 +381,12 @@ const char *fmt_ident(const char *name, const char *email,
        if (!email) {
                if (strict && ident_use_config_only
                    && !(ident_config_given & IDENT_MAIL_GIVEN)) {
-                       fputs(env_hint, stderr);
+                       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);
+                       fputs(_(env_hint), stderr);
                        die("unable to auto-detect email address (got '%s')", email);
                }
        }