git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 1/2] ident: check for useConfigOnly before auto-detection of name/email

From
Marios Titas <redneb@gmx.com>
Date
Mar 30, 2016, 19:29 UTC
Message-ID
<1459366183-15451-1-git-send-email-redneb@gmx.com>

If user.useConfigOnly is set, it does not make sense to try to auto-detect the name and/or the email. So it's better to do the useConfigOnly checks first.

Signed-off-by: Marios Titas <redneb@gmx.com>
---
 ident.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/ident.c b/ident.c
index 6e12582..74b2663 100644
--- a/ident.c
+++ b/ident.c
@@ -351,15 +351,15 @@ const char *fmt_ident(const char *name, const char *email,
 	if (want_name) {
 		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");
 			name = ident_default_name();
 			using_default = 1;
 			if (strict && default_name_is_bogus) {
 				fputs(env_hint, stderr);
 				die("unable to auto-detect name (got '%s')", name);
 			}
-			if (strict && ident_use_config_only
-			    && !(ident_config_given & IDENT_NAME_GIVEN))
-				die("user.useConfigOnly set but no name given");
 		}
 		if (!*name) {
 			struct passwd *pw;
@@ -374,14 +374,14 @@ 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");
 		email = ident_default_email();
 		if (strict && default_email_is_bogus) {
 			fputs(env_hint, stderr);
 			die("unable to auto-detect email address (got '%s')", email);
 		}
-		if (strict && ident_use_config_only
-		    && !(ident_config_given & IDENT_MAIL_GIVEN))
-			die("user.useConfigOnly set but no mail given");
 	}
 
 	strbuf_reset(&ident);
-- 
2.8.0
Next: Marios Titas
Message 1 of 10 in “ident: check for useConfigOnly before auto-detection of name/email”
  1. 1/2 ident: check for useConfigOnly before auto-detection of name/emailMarios Titas, Mar 30, 2016
  2. 2/2 ident: make the useConfigOnly error messages more informativeMarios Titas, Mar 30, 2016
  3. Junio C HamanoMar 30, 2016
  4. Marios TitasMar 30, 2016
  5. Junio C HamanoApr 1, 2016
  6. Junio C HamanoApr 12, 2016
  7. Jeff KingMar 31, 2016
  8. Marios TitasMar 31, 2016
  9. Jeff KingMar 31, 2016
  10. Junio C HamanoApr 1, 2016

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.