Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDerrick Stolee <dstolee@microsoft.com>2019-08-13 21:37:46 +0300
committerJunio C Hamano <gitster@pobox.com>2019-08-13 23:33:55 +0300
commitad0fb65999382052cf21408df490d0b39800d487 (patch)
tree52e75283d8c994de331fe84f9082b6ed6953e564 /read-cache.c
parent31b1de6a09bad59cc0d88419925486afc7add277 (diff)
repo-settings: parse core.untrackedCache
The core.untrackedCache config setting is slightly complicated, so clarify its use and centralize its parsing into the repo settings. The default value is "keep" (returned as -1), which persists the untracked cache if it exists. If the value is set as "false" (returned as 0), then remove the untracked cache if it exists. If the value is set as "true" (returned as 1), then write the untracked cache and persist it. Instead of relying on magic values of -1, 0, and 1, split these options into an enum. This allows the use of "-1" as a default value. After parsing the config options, if the value is unset we can initialize it to UNTRACKED_CACHE_KEEP. Signed-off-by: Derrick Stolee <dstolee@microsoft.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'read-cache.c')
-rw-r--r--read-cache.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/read-cache.c b/read-cache.c
index 59dbebc15d..7a07286164 100644
--- a/read-cache.c
+++ b/read-cache.c
@@ -1845,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)