From 61b37cafe748a768b14cb34fb7634dadf4d0fa16 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 59f4ae986433f1..cf3aa9b7b64595 100644 --- a/read-cache.c +++ b/read-cache.c @@ -2411,7 +2411,8 @@ int do_read_index(struct index_state *istate, const char *path, int must_exist) * settings and other properties of the index (if necessary). */ 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); else ensure_correct_sparsity(istate);