summaryrefslogtreecommitdiff
path: root/ident.c
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2012-05-21 23:09:54 (GMT)
committerJunio C Hamano <gitster@pobox.com>2012-05-22 16:07:53 (GMT)
commit9597921b6c173d90359e2cfa4c2e36de8d1554e6 (patch)
tree36828f30283c0aedb451678417905cafd14cc705 /ident.c
parente21ab1340a1a22f017e9c3e4fc0deb9f4de36917 (diff)
downloadgit-9597921b6c173d90359e2cfa4c2e36de8d1554e6.zip
git-9597921b6c173d90359e2cfa4c2e36de8d1554e6.tar.gz
git-9597921b6c173d90359e2cfa4c2e36de8d1554e6.tar.bz2
move identity config parsing to ident.c
There's no reason for this to be in config, except that once upon a time all of the config parsing was there. It makes more sense to keep the ident code together. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'ident.c')
-rw-r--r--ident.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/ident.c b/ident.c
index 0f7dcae..bb1158f 100644
--- a/ident.c
+++ b/ident.c
@@ -388,3 +388,24 @@ int user_ident_sufficiently_given(void)
return (user_ident_explicitly_given == IDENT_ALL_GIVEN);
#endif
}
+
+int git_ident_config(const char *var, const char *value, void *data)
+{
+ if (!strcmp(var, "user.name")) {
+ if (!value)
+ return config_error_nonbool(var);
+ strlcpy(git_default_name, value, sizeof(git_default_name));
+ user_ident_explicitly_given |= IDENT_NAME_GIVEN;
+ return 0;
+ }
+
+ if (!strcmp(var, "user.email")) {
+ if (!value)
+ return config_error_nonbool(var);
+ strlcpy(git_default_email, value, sizeof(git_default_email));
+ user_ident_explicitly_given |= IDENT_MAIL_GIVEN;
+ return 0;
+ }
+
+ return 0;
+}