]> git.ipfire.org Git - thirdparty/git.git/commitdiff
update-index: ensure full index
authorDerrick Stolee <dstolee@microsoft.com>
Thu, 1 Apr 2021 01:49:53 +0000 (01:49 +0000)
committerJunio C Hamano <gitster@pobox.com>
Wed, 14 Apr 2021 20:47:29 +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>
builtin/update-index.c

index 79087bccea4b8ba78a9d0bd22553b39f84b0e2e1..f1f16f2de526d907cc8c5b41da64a7eef3d22a7d 100644 (file)
@@ -745,6 +745,8 @@ static int do_reupdate(int ac, const char **av,
                 */
                has_head = 0;
  redo:
+       /* TODO: audit for interaction with sparse-index. */
+       ensure_full_index(&the_index);
        for (pos = 0; pos < active_nr; pos++) {
                const struct cache_entry *ce = active_cache[pos];
                struct cache_entry *old = NULL;