[PATCH 22/27] pathspec: ensure full index
- From
Derrick Stolee via GitGitGadget <gitgitgadget@gmail.com>
- Date
- Mar 16, 2021, 21:17 UTC
- Message-ID
- <f4c470686b2764a6046c8a8b80f18c882ad8899b.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> --- pathspec.c | 1 + 1 file changed, 1 insertion(+)
diff --git a/pathspec.c b/pathspec.c index b6e333965cb4..08736ab368d9 100644 --- a/pathspec.c +++ b/pathspec.c @@ -36,6 +36,7 @@ void add_pathspec_matches_against_index(const struct pathspec *pathspec, num_unmatched++; if (!num_unmatched) return; + ensure_full_index(istate); for (i = 0; i < istate->cache_nr; i++) { const struct cache_entry *ce = istate->cache[i]; ce_path_match(istate, ce, pathspec, seen);
-- gitgitgadget