diff --git a/read-cache.c b/read-cache.c index 5d3c8bd4aa..acb132d8bf 100644 --- a/read-cache.c +++ b/read-cache.c @@ -1238,24 +1238,16 @@ static struct cache_entry *refresh_cache_entry(struct cache_entry *ce, #define INDEX_FORMAT_DEFAULT 3 -static int index_format_config(const char *var, const char *value, void *cb) -{ - unsigned int *version = cb; - if (!strcmp(var, "index.version")) { - *version = git_config_int(var, value); - return 0; - } - return 1; -} - static unsigned int get_index_format_default(void) { char *envversion = getenv("GIT_INDEX_VERSION"); char *endp; + int value; unsigned int version = INDEX_FORMAT_DEFAULT; if (!envversion) { - git_config(index_format_config, &version); + if (!git_config_get_int("index.version", &value)) + version = value; if (version < INDEX_FORMAT_LB || INDEX_FORMAT_UB < version) { warning(_("index.version set, but the value is invalid.\n" "Using version %i"), INDEX_FORMAT_DEFAULT);