From 7562ff53f08d4a57ee6073ebb1be2ede1254fa75 Mon Sep 17 00:00:00 2001 From: Victoria Dye Date: Mon, 11 Oct 2021 15:18:35 -0400 Subject: [PATCH] sparse-index: fix index.sparse inline usage Update behavior when the `index.sparse` config setting is provided inline to a command. Previously would run command on sparse index (unless otherwise expanded), then write out as sparse. Now, the index will be expanded in the process of reading it in. Co-authored-by: Derrick Stolee Signed-off-by: Victoria Dye --- read-cache.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/read-cache.c b/read-cache.c index 9aaba14073672c..ebe88cd039dd1c 100644 --- a/read-cache.c +++ b/read-cache.c @@ -2405,7 +2405,8 @@ int do_read_index(struct index_state *istate, const char *path, int must_exist) if (!istate->repo) istate->repo = the_repository; prepare_repo_settings(istate->repo); - if (istate->repo->settings.command_requires_full_index) + if (!istate->repo->settings.sparse_index || + istate->repo->settings.command_requires_full_index) ensure_full_index(istate); return istate->cache_nr;