Skip to content

Commit

Permalink
Split up default "user" config parsing into helper routine
Browse files Browse the repository at this point in the history
This follows the example of the "core" config, and splits out the
default "user" config option parsing into a helper routine.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Linus Torvalds authored and Junio C Hamano committed Jun 18, 2008
1 parent 806e2ad commit d136452
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions config.c
Original file line number Diff line number Diff line change
Expand Up @@ -464,11 +464,8 @@ static int git_default_core_config(const char *var, const char *value)
return 0;
}

int git_default_config(const char *var, const char *value, void *dummy)
static int git_default_user_config(const char *var, const char *value)
{
if (!prefixcmp(var, "core."))
return git_default_core_config(var, value);

if (!strcmp(var, "user.name")) {
if (!value)
return config_error_nonbool(var);
Expand All @@ -487,6 +484,18 @@ int git_default_config(const char *var, const char *value, void *dummy)
return 0;
}

/* Add other config variables here and to Documentation/config.txt. */
return 0;
}

int git_default_config(const char *var, const char *value, void *dummy)
{
if (!prefixcmp(var, "core."))
return git_default_core_config(var, value);

if (!prefixcmp(var, "user."))
return git_default_user_config(var, value);

if (!strcmp(var, "i18n.commitencoding"))
return git_config_string(&git_commit_encoding, var, value);

Expand Down

0 comments on commit d136452

Please sign in to comment.