[PATCH 2/2] ident: make the useConfigOnly error messages more informative
- From
Marios Titas <redneb@gmx.com>
- Date
- Mar 30, 2016, 19:29 UTC
- Message-ID
- <1459366183-15451-2-git-send-email-redneb@gmx.com>
- In-Reply-To
- <1459366183-15451-1-git-send-email-redneb@gmx.com>
The env_hint message applies perfectly to the case when user.useConfigOnly is set and at least one of the user.name and the user.email are not provided. Additionally, use a more descriptive error message when that happens.
Signed-off-by: Marios Titas <redneb@gmx.com> --- ident.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/ident.c b/ident.c index 74b2663..4fd82d1 100644 --- a/ident.c +++ b/ident.c @@ -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);
-- 2.8.0