diff options
author | Junio C Hamano <gitster@pobox.com> | 2021-12-11 01:35:01 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2021-12-11 01:35:01 +0300 |
commit | 5396d7b298e9db83e98fb6a552a42a6a59984305 (patch) | |
tree | 268a3d472bd5be4ec42da86a026a19a45e856b4f /read-cache.c | |
parent | 83113c4268419cef690201916ac0ebbd7c721d93 (diff) | |
parent | 7ca4fc8819e60bbeb21a8684af182d321b338c47 (diff) |
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.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/read-cache.c b/read-cache.c index f398659662..d999fff9e4 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; |