summaryrefslogtreecommitdiff
path: root/repo-settings.c
diff options
context:
space:
mode:
authorDerrick Stolee <dstolee@microsoft.com>2021-03-30 13:10:47 (GMT)
committerJunio C Hamano <gitster@pobox.com>2021-03-30 19:57:45 (GMT)
commit3964fc2aae7c7420a4c5da1b9530e8e8de1ed367 (patch)
tree6b4872a266678c396757fcaa36c89351671a23b9 /repo-settings.c
parent4b3f765a2f38064c0bb221c76c7bb4f28f94a9dc (diff)
downloadgit-3964fc2aae7c7420a4c5da1b9530e8e8de1ed367.zip
git-3964fc2aae7c7420a4c5da1b9530e8e8de1ed367.tar.gz
git-3964fc2aae7c7420a4c5da1b9530e8e8de1ed367.tar.bz2
sparse-index: add guard to ensure full index
Upcoming changes will introduce modifications to the index format that allow sparse directories. It will be useful to have a mechanism for converting those sparse index files into full indexes by walking the tree at those sparse directories. Name this method ensure_full_index() as it will guarantee that the index is fully expanded. This method is not implemented yet, and instead we focus on the scaffolding to declare it and call it at the appropriate time. Add a 'command_requires_full_index' member to struct repo_settings. This will be an indicator that we need the index in full mode to do certain index operations. This starts as being true for every command, then we will set it to false as some commands integrate with sparse indexes. If 'command_requires_full_index' is true, then we will immediately expand a sparse index to a full one upon reading from disk. This suffices for now, but we will want to add more callers to ensure_full_index() later. Signed-off-by: Derrick Stolee <dstolee@microsoft.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'repo-settings.c')
-rw-r--r--repo-settings.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/repo-settings.c b/repo-settings.c
index f7fff0f..d63569e 100644
--- a/repo-settings.c
+++ b/repo-settings.c
@@ -77,4 +77,12 @@ void prepare_repo_settings(struct repository *r)
UPDATE_DEFAULT_BOOL(r->settings.core_untracked_cache, UNTRACKED_CACHE_KEEP);
UPDATE_DEFAULT_BOOL(r->settings.fetch_negotiation_algorithm, FETCH_NEGOTIATION_DEFAULT);
+
+ /*
+ * This setting guards all index reads to require a full index
+ * over a sparse index. After suitable guards are placed in the
+ * codebase around uses of the index, this setting will be
+ * removed.
+ */
+ r->settings.command_requires_full_index = 1;
}