move identity config parsing to ident.c
[gitweb.git] / ident.c
diff --git a/ident.c b/ident.c
index 0f7dcae8f8d14838c27dc67a7a793aa244497153..bb1158f7d2a76d08a7a4398b2d25a0632fd081a1 100644 (file)
--- 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;
+}