From: Derrick Stolee Date: Thu, 1 Apr 2021 01:49:57 +0000 (+0000) Subject: pathspec: ensure full index X-Git-Tag: v2.32.0-rc0~59^2~6 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=465a04abc6e5f4fe2b93c662bab0319c1667180e;p=thirdparty%2Fgit.git pathspec: 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/pathspec.c b/pathspec.c index b6e333965c..d67688bab7 100644 --- a/pathspec.c +++ b/pathspec.c @@ -36,6 +36,8 @@ void add_pathspec_matches_against_index(const struct pathspec *pathspec, num_unmatched++; if (!num_unmatched) return; + /* TODO: audit for interaction with sparse-index. */ + 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);