summary refs log tree commit diff
path: root/repository.h
diff options
context:
space:
mode:
authorDerrick Stolee <dstolee@microsoft.com>2019-08-13 11:37:46 -0700
committerJunio C Hamano <gitster@pobox.com>2019-08-13 13:33:55 -0700
commitad0fb65999382052cf21408df490d0b39800d487 (patch)
tree52e75283d8c994de331fe84f9082b6ed6953e564 /repository.h
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 'repository.h')
-rw-r--r--repository.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/repository.h b/repository.h
index cc285ad327..cf7ff0778c 100644
--- a/repository.h
+++ b/repository.h
@@ -11,6 +11,13 @@ struct pathspec;
 struct raw_object_store;
 struct submodule_cache;
 
+enum untracked_cache_setting {
+	UNTRACKED_CACHE_UNSET = -1,
+	UNTRACKED_CACHE_REMOVE = 0,
+	UNTRACKED_CACHE_KEEP = 1,
+	UNTRACKED_CACHE_WRITE = 2
+};
+
 struct repo_settings {
 	int initialized;
 
@@ -18,6 +25,7 @@ struct repo_settings {
 	int gc_write_commit_graph;
 
 	int index_version;
+	enum untracked_cache_setting core_untracked_cache;
 
 	int pack_use_sparse;
 };