]> git.ipfire.org Git - thirdparty/git.git/commitdiff
commit: ensure full index
authorDerrick Stolee <dstolee@microsoft.com>
Thu, 1 Apr 2021 01:49:45 +0000 (01:49 +0000)
committerJunio C Hamano <gitster@pobox.com>
Wed, 14 Apr 2021 20:47:06 +0000 (13:47 -0700)
These two loops iterate over all cache entries, so ensure that a sparse
index is expanded to a full index before we do so.

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/commit.c

index 739110c5a7f60d0d8927f7034f3b8c8cc368ea82..cf0c36d1dcb2eb345f3c86134ac523f575fb4493 100644 (file)
@@ -251,6 +251,8 @@ static int list_paths(struct string_list *list, const char *with_tree,
                free(max_prefix);
        }
 
+       /* TODO: audit for interaction with sparse-index. */
+       ensure_full_index(&the_index);
        for (i = 0; i < active_nr; i++) {
                const struct cache_entry *ce = active_cache[i];
                struct string_list_item *item;
@@ -931,6 +933,8 @@ static int prepare_to_commit(const char *index_file, const char *prefix,
                if (get_oid(parent, &oid)) {
                        int i, ita_nr = 0;
 
+                       /* TODO: audit for interaction with sparse-index. */
+                       ensure_full_index(&the_index);
                        for (i = 0; i < active_nr; i++)
                                if (ce_intent_to_add(active_cache[i]))
                                        ita_nr++;