summaryrefslogtreecommitdiff
path: root/ident.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2010-01-08 07:39:11 -0800
committerJunio C Hamano <gitster@pobox.com>2010-01-10 09:42:54 -0800
commit91c38a21089c4b30d35f392386c752a017ac6db0 (patch)
tree1777d7d8c6bd89f00fc4ac21c49705d532f6eca7 /ident.c
parent18e95f279ec62cc8d5e5ab709b162ccc55eebf0a (diff)
downloadgit-91c38a21089c4b30d35f392386c752a017ac6db0.tar.gz
ident.c: check explicit identity for name and email separately
bb1ae3f (commit: Show committer if automatic, 2008-05-04) added a logic to check both name and email were given explicitly by the end user, but it assumed that fmt_ident() is never called before git_default_user_config() is called, which was fragile. The former calls setup_ident() and fills the "default" name and email, so the check in the config parser would have mistakenly said both are given even if only user.name was provided. Make the logic more robust by keeping track of name and email separately. Signed-off-by: Junio C Hamano <gitster@pobox.com> Acked-by: Santi BĂ©jar <santi@agolina.net>
Diffstat (limited to 'ident.c')
-rw-r--r--ident.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/ident.c b/ident.c
index e6c1798d98..e67c5ad1e8 100644
--- a/ident.c
+++ b/ident.c
@@ -249,9 +249,10 @@ const char *git_author_info(int flag)
const char *git_committer_info(int flag)
{
- if (getenv("GIT_COMMITTER_NAME") &&
- getenv("GIT_COMMITTER_EMAIL"))
- user_ident_explicitly_given = 1;
+ if (getenv("GIT_COMMITTER_NAME"))
+ user_ident_explicitly_given |= IDENT_NAME_GIVEN;
+ if (getenv("GIT_COMMITTER_EMAIL"))
+ user_ident_explicitly_given |= IDENT_MAIL_GIVEN;
return fmt_ident(getenv("GIT_COMMITTER_NAME"),
getenv("GIT_COMMITTER_EMAIL"),
getenv("GIT_COMMITTER_DATE"),