sparse-index: add index.sparse config option

When enabled, this config option signals that index writes should
attempt to use sparse-directory entries.

Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Derrick Stolee
2021-03-30 13:10:59 +00:00
committed by Junio C Hamano
parent 0938e6ff55
commit 58300f4743
5 changed files with 44 additions and 6 deletions

View File

@ -85,4 +85,11 @@ void prepare_repo_settings(struct repository *r)
* removed.
*/
r->settings.command_requires_full_index = 1;
/*
* Initialize this as off.
*/
r->settings.sparse_index = 0;
if (!repo_config_get_bool(r, "index.sparse", &value) && value)
r->settings.sparse_index = 1;
}