Skip to content

Commit 1141f49

Browse files
torvaldsgitster
authored andcommitted
Split up default "i18n" and "branch" config parsing into helper routines
.. just to finish it off. We'll leave the pager color config alone, since it is such an odd-ball special case anyway. Signed-off-by: Linus Torvalds <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent d136452 commit 1141f49

File tree

1 file changed

+29
-11
lines changed

1 file changed

+29
-11
lines changed

config.c

Lines changed: 29 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -488,25 +488,20 @@ static int git_default_user_config(const char *var, const char *value)
488488
return 0;
489489
}
490490

491-
int git_default_config(const char *var, const char *value, void *dummy)
491+
static int git_default_i18n_config(const char *var, const char *value)
492492
{
493-
if (!prefixcmp(var, "core."))
494-
return git_default_core_config(var, value);
495-
496-
if (!prefixcmp(var, "user."))
497-
return git_default_user_config(var, value);
498-
499493
if (!strcmp(var, "i18n.commitencoding"))
500494
return git_config_string(&git_commit_encoding, var, value);
501495

502496
if (!strcmp(var, "i18n.logoutputencoding"))
503497
return git_config_string(&git_log_output_encoding, var, value);
504498

505-
if (!strcmp(var, "pager.color") || !strcmp(var, "color.pager")) {
506-
pager_use_color = git_config_bool(var,value);
507-
return 0;
508-
}
499+
/* Add other config variables here and to Documentation/config.txt. */
500+
return 0;
501+
}
509502

503+
static int git_default_branch_config(const char *var, const char *value)
504+
{
510505
if (!strcmp(var, "branch.autosetupmerge")) {
511506
if (value && !strcasecmp(value, "always")) {
512507
git_branch_track = BRANCH_TRACK_ALWAYS;
@@ -535,6 +530,29 @@ int git_default_config(const char *var, const char *value, void *dummy)
535530
return 0;
536531
}
537532

533+
int git_default_config(const char *var, const char *value, void *dummy)
534+
{
535+
if (!prefixcmp(var, "core."))
536+
return git_default_core_config(var, value);
537+
538+
if (!prefixcmp(var, "user."))
539+
return git_default_user_config(var, value);
540+
541+
if (!prefixcmp(var, "i18n."))
542+
return git_default_i18n_config(var, value);
543+
544+
if (!prefixcmp(var, "branch."))
545+
return git_default_branch_config(var, value);
546+
547+
if (!strcmp(var, "pager.color") || !strcmp(var, "color.pager")) {
548+
pager_use_color = git_config_bool(var,value);
549+
return 0;
550+
}
551+
552+
/* Add other config variables here and to Documentation/config.txt. */
553+
return 0;
554+
}
555+
538556
int git_config_from_file(config_fn_t fn, const char *filename, void *data)
539557
{
540558
int ret;

0 commit comments

Comments
 (0)