summaryrefslogtreecommitdiff
path: root/read-cache.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2019-09-09 19:26:36 (GMT)
committerJunio C Hamano <gitster@pobox.com>2019-09-09 19:26:36 (GMT)
commitf4f8dfe127918241c1e3448436d32a89f13fa5a8 (patch)
tree7da8889b7333a7744024f53192f397f68b5b9761 /read-cache.c
parent4a12f89865236789b5723277bb6809e92ce68f54 (diff)
parentaaf633c2ad10b47af7623c130ddfe7231658c7e4 (diff)
downloadgit-f4f8dfe127918241c1e3448436d32a89f13fa5a8.zip
git-f4f8dfe127918241c1e3448436d32a89f13fa5a8.tar.gz
git-f4f8dfe127918241c1e3448436d32a89f13fa5a8.tar.bz2
Merge branch 'ds/feature-macros'
A mechanism to affect the default setting for a (related) group of configuration variables is introduced. * ds/feature-macros: repo-settings: create feature.experimental setting repo-settings: create feature.manyFiles setting repo-settings: parse core.untrackedCache commit-graph: turn on commit-graph by default t6501: use 'git gc' in quiet mode repo-settings: consolidate some config settings
Diffstat (limited to 'read-cache.c')
-rw-r--r--read-cache.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/read-cache.c b/read-cache.c
index 52ffa8a..cff1280 100644
--- a/read-cache.c
+++ b/read-cache.c
@@ -1599,16 +1599,17 @@ struct cache_entry *refresh_cache_entry(struct index_state *istate,
#define INDEX_FORMAT_DEFAULT 3
-static unsigned int get_index_format_default(void)
+static unsigned int get_index_format_default(struct repository *r)
{
char *envversion = getenv("GIT_INDEX_VERSION");
char *endp;
- int value;
unsigned int version = INDEX_FORMAT_DEFAULT;
if (!envversion) {
- if (!git_config_get_int("index.version", &value))
- version = value;
+ prepare_repo_settings(r);
+
+ if (r->settings.index_version >= 0)
+ version = r->settings.index_version;
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);
@@ -1844,18 +1845,17 @@ static void check_ce_order(struct index_state *istate)
static void tweak_untracked_cache(struct index_state *istate)
{
- switch (git_config_get_untracked_cache()) {
- case -1: /* keep: do nothing */
- break;
- case 0: /* false */
+ struct repository *r = the_repository;
+
+ prepare_repo_settings(r);
+
+ if (r->settings.core_untracked_cache == UNTRACKED_CACHE_REMOVE) {
remove_untracked_cache(istate);
- break;
- case 1: /* true */
- add_untracked_cache(istate);
- break;
- default: /* unknown value: do nothing */
- break;
+ return;
}
+
+ if (r->settings.core_untracked_cache == UNTRACKED_CACHE_WRITE)
+ add_untracked_cache(istate);
}
static void tweak_split_index(struct index_state *istate)
@@ -2765,7 +2765,7 @@ static int do_write_index(struct index_state *istate, struct tempfile *tempfile,
}
if (!istate->version) {
- istate->version = get_index_format_default();
+ istate->version = get_index_format_default(the_repository);
if (git_env_bool("GIT_TEST_SPLIT_INDEX", 0))
init_split_index(istate);
}