diff options
author | Marios Titas <redneb@gmx.com> | 2016-03-30 22:29:43 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2016-04-01 15:01:20 -0700 |
commit | d3c06c196964c02f7343b53301e0e85679fad51f (patch) | |
tree | 8cea524ea19633b0fc59206ec7f65dbb145acd5c | |
parent | ident: check for useConfigOnly before auto-detection of name/email (diff) | |
download | tgif-d3c06c196964c02f7343b53301e0e85679fad51f.tar.xz |
ident: give "please tell me" message upon useConfigOnly error
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 less descriptive error message to discourage
users from disabling user.useConfigOnly configuration variable to
work around this error condition. We want to encourage them to set
user.name or user.email instead.
Signed-off-by: Marios Titas <redneb@gmx.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r-- | ident.c | 12 |
1 files changed, 8 insertions, 4 deletions
@@ -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); |