From: Derrick Stolee Date: Thu, 1 Apr 2021 01:49:42 +0000 (+0000) Subject: add: ensure full index X-Git-Tag: v2.32.0-rc0~59^2~21 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=54beed24d22867a98fc247e1031e3486573f1553;p=thirdparty%2Fgit.git 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 Reviewed-by: Elijah Newren Signed-off-by: Junio C Hamano --- diff --git a/builtin/add.c b/builtin/add.c index ea762a41e3..afccf2fd55 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];