]> git.ipfire.org Git - thirdparty/git.git/commitdiff
entry: ensure full index
authorDerrick Stolee <dstolee@microsoft.com>
Thu, 1 Apr 2021 01:49:55 +0000 (01:49 +0000)
committerJunio C Hamano <gitster@pobox.com>
Wed, 14 Apr 2021 20:47:35 +0000 (13:47 -0700)
Before iterating over all cache entries, ensure that a sparse index is
expanded to a full index to avoid unexpected behavior.

Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Reviewed-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
entry.c

diff --git a/entry.c b/entry.c
index 7b9f43716f76e6e7a701966045429b263cfb691e..891e4ba2b45a289daf423b60b07658342b6fd1c5 100644 (file)
--- a/entry.c
+++ b/entry.c
@@ -412,6 +412,8 @@ static void mark_colliding_entries(const struct checkout *state,
 
        ce->ce_flags |= CE_MATCHED;
 
+       /* TODO: audit for interaction with sparse-index. */
+       ensure_full_index(state->istate);
        for (i = 0; i < state->istate->cache_nr; i++) {
                struct cache_entry *dup = state->istate->cache[i];