summaryrefslogtreecommitdiff
path: root/builtin/update-index.c
diff options
context:
space:
mode:
authorDerrick Stolee <dstolee@microsoft.com>2021-04-01 01:49:53 +0000
committerJunio C Hamano <gitster@pobox.com>2021-04-14 13:47:29 -0700
commit2508df0272fdae3025b53366ac6b456920bc0de0 (patch)
treebeb982d34a45c40e4e503c7f370d17a1015b63c6 /builtin/update-index.c
parenta02912019a7a473b039d28713fb6419bf472386f (diff)
downloadgit-2508df0272fdae3025b53366ac6b456920bc0de0.tar.gz
update-index: ensure full index
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>
Diffstat (limited to 'builtin/update-index.c')
-rw-r--r--builtin/update-index.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/builtin/update-index.c b/builtin/update-index.c
index 79087bccea..f1f16f2de5 100644
--- a/builtin/update-index.c
+++ b/builtin/update-index.c
@@ -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;