summaryrefslogtreecommitdiff
path: root/read-cache.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2021-12-10 22:35:01 (GMT)
committerJunio C Hamano <gitster@pobox.com>2021-12-10 22:35:01 (GMT)
commit5396d7b298e9db83e98fb6a552a42a6a59984305 (patch)
tree268a3d472bd5be4ec42da86a026a19a45e856b4f /read-cache.c
parent83113c4268419cef690201916ac0ebbd7c721d93 (diff)
parent7ca4fc8819e60bbeb21a8684af182d321b338c47 (diff)
downloadgit-5396d7b298e9db83e98fb6a552a42a6a59984305.zip
git-5396d7b298e9db83e98fb6a552a42a6a59984305.tar.gz
git-5396d7b298e9db83e98fb6a552a42a6a59984305.tar.bz2
Merge branch 'vd/sparse-sparsity-fix-on-read'
Ensure that the sparseness of the in-core index matches the index.sparse configuration specified by the repository immediately after the on-disk index file is read. * vd/sparse-sparsity-fix-on-read: sparse-index: update do_read_index to ensure correct sparsity sparse-index: add ensure_correct_sparsity function sparse-index: avoid unnecessary cache tree clearing test-read-cache.c: prepare_repo_settings after config init
Diffstat (limited to 'read-cache.c')
-rw-r--r--read-cache.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/read-cache.c b/read-cache.c
index f398659..d999fff 100644
--- a/read-cache.c
+++ b/read-cache.c
@@ -2352,9 +2352,17 @@ int do_read_index(struct index_state *istate, const char *path, int must_exist)
if (!istate->repo)
istate->repo = the_repository;
+
+ /*
+ * If the command explicitly requires a full index, force it
+ * to be full. Otherwise, correct the sparsity based on repository
+ * settings and other properties of the index (if necessary).
+ */
prepare_repo_settings(istate->repo);
if (istate->repo->settings.command_requires_full_index)
ensure_full_index(istate);
+ else
+ ensure_correct_sparsity(istate);
return istate->cache_nr;