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

index ea762a41e3a2d2c41718de2e97c6a0e6031ce91c..afccf2fd55431ab0210a81f662ceeca4981d867e 100644 (file)
@@ -141,6 +141,8 @@ static int renormalize_tracked_files(const struct pathspec *pathspec, int flags)
 {
        int i, retval = 0;
 
+       /* TODO: audit for interaction with sparse-index. */
+       ensure_full_index(&the_index);
        for (i = 0; i < active_nr; i++) {
                struct cache_entry *ce = active_cache[i];