add: 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>
Derrick Stolee committed
Apr 1, 2021 at 01:49 UTC
54beed24d22867a98fc247e1031e3486573f1553
1 file changed
+2
builtin/add.c
+2
@@ -141,6 +141,8 @@ static int renormalize_tracked_files(const struct pathspec *pathspec, int flags)
141
{
142
int i, retval = 0;
143
144
+ /* TODO: audit for interaction with sparse-index. */
145
+ ensure_full_index(&the_index);
146
for (i = 0; i < active_nr; i++) {
147
struct cache_entry *ce = active_cache[i];
148