summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDerrick Stolee <dstolee@microsoft.com>2021-04-01 01:49:42 (GMT)
committerJunio C Hamano <gitster@pobox.com>2021-04-14 20:46:48 (GMT)
commit54beed24d22867a98fc247e1031e3486573f1553 (patch)
tree7d40d732ec46c65fbc595f7f60d3c0099b380773
parent118a2e8bde0982d219607ff9f260b9cfeb25585c (diff)
downloadgit-54beed24d22867a98fc247e1031e3486573f1553.zip
git-54beed24d22867a98fc247e1031e3486573f1553.tar.gz
git-54beed24d22867a98fc247e1031e3486573f1553.tar.bz2
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>
-rw-r--r--builtin/add.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/builtin/add.c b/builtin/add.c
index ea762a4..afccf2f 100644
--- a/builtin/add.c
+++ b/builtin/add.c
@@ -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];