git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] ident: check for useConfigOnly before auto-detection of name/email
@ 2016-03-30 19:29 Marios Titas
  2016-03-30 19:29 ` [PATCH 2/2] ident: make the useConfigOnly error messages more informative Marios Titas
  2016-03-31 14:40 ` [PATCH 1/2] ident: check for useConfigOnly before auto-detection of name/email Jeff King
  0 siblings, 2 replies; 10+ messages in thread
From: Marios Titas @ 2016-03-30 19:29 UTC (permalink / raw)
  To: git; +Cc: Marios Titas

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

^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2016-04-12 23:19 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-30 19:29 [PATCH 1/2] ident: check for useConfigOnly before auto-detection of name/email Marios Titas
2016-03-30 19:29 ` [PATCH 2/2] ident: make the useConfigOnly error messages more informative Marios Titas
2016-03-30 22:27   ` Junio C Hamano
2016-03-30 23:25     ` Marios Titas
2016-04-01 22:04       ` Junio C Hamano
2016-04-12 23:19         ` Junio C Hamano
2016-03-31 14:40 ` [PATCH 1/2] ident: check for useConfigOnly before auto-detection of name/email Jeff King
2016-03-31 15:01   ` Marios Titas
2016-03-31 16:31     ` Jeff King
2016-04-01 22:00     ` Junio C Hamano

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).