diff options
author | Russell Belfer <rb@github.com> | 2013-04-23 01:27:36 +0400 |
---|---|---|
committer | Russell Belfer <rb@github.com> | 2013-04-23 23:57:30 +0400 |
commit | eac76c230c92594eaa528e50746119bd3c33ffbb (patch) | |
tree | 0f03ff2ab3cb7c4d4c94106e108f3ba0e129afa8 /src/index.c | |
parent | ab01cbd4ddd756c7beda3f483791cb5d4e211872 (diff) |
Use config cache where possible
This converts many of the config lookups that are done around the
library to use the repository config cache. This was everything I
could find that wasn't part of diff (which requires a larger fix).
Diffstat (limited to 'src/index.c')
-rw-r--r-- | src/index.c | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/src/index.c b/src/index.c index 2afd28158..d8ca78e52 100644 --- a/src/index.c +++ b/src/index.c @@ -330,7 +330,7 @@ void git_index_clear(git_index *index) git_vector_clear(&index->entries); git_index_reuc_clear(index); - + git_futils_filestamp_set(&index->stamp, NULL); git_tree_cache_free(index->tree); @@ -352,19 +352,18 @@ int git_index_set_caps(git_index *index, unsigned int caps) old_ignore_case = index->ignore_case; if (caps == GIT_INDEXCAP_FROM_OWNER) { - git_config *cfg; + git_repository *repo = INDEX_OWNER(index); int val; - if (INDEX_OWNER(index) == NULL || - git_repository_config__weakptr(&cfg, INDEX_OWNER(index)) < 0) - return create_index_error(-1, - "Cannot get repository config to set index caps"); + if (!repo) + return create_index_error( + -1, "Cannot access repository to set index caps"); - if (git_config_get_bool(&val, cfg, "core.ignorecase") == 0) + if (!git_repository__cvar(&val, repo, GIT_CVAR_IGNORECASE)) index->ignore_case = (val != 0); - if (git_config_get_bool(&val, cfg, "core.filemode") == 0) + if (!git_repository__cvar(&val, repo, GIT_CVAR_FILEMODE)) index->distrust_filemode = (val == 0); - if (git_config_get_bool(&val, cfg, "core.symlinks") == 0) + if (!git_repository__cvar(&val, repo, GIT_CVAR_SYMLINKS)) index->no_symlinks = (val == 0); } else { |