[PATCH 05/27] add: ensure full index
- From
Derrick Stolee via GitGitGadget <gitgitgadget@gmail.com>
- Date
- Mar 16, 2021, 21:16 UTC
- Message-ID
- <142df1ab8e3e8ea5e213f2477e271e60e5b62f84.1615929436.git.gitgitgadget@gmail.com>
- In-Reply-To
- <pull.906.git.1615929435.gitgitgadget@gmail.com>
From: Derrick Stolee <dstolee@microsoft.com>
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> --- builtin/add.c | 1 + 1 file changed, 1 insertion(+)
diff --git a/builtin/add.c b/builtin/add.c index ea762a41e3a2..ab2ef4a63530 100644 --- a/builtin/add.c +++ b/builtin/add.c @@ -141,6 +141,7 @@ static int renormalize_tracked_files(const struct pathspec *pathspec, int flags) { int i, retval = 0; + ensure_full_index(&the_index); for (i = 0; i < active_nr; i++) { struct cache_entry *ce = active_cache[i];
-- gitgitgadget