Skip to content

Commit 465a04a

Browse files
derrickstoleegitster
authored andcommitted
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 <[email protected]> Reviewed-by: Elijah Newren <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent f7ef64b commit 465a04a

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

pathspec.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ void add_pathspec_matches_against_index(const struct pathspec *pathspec,
3636
num_unmatched++;
3737
if (!num_unmatched)
3838
return;
39+
/* TODO: audit for interaction with sparse-index. */
40+
ensure_full_index(istate);
3941
for (i = 0; i < istate->cache_nr; i++) {
4042
const struct cache_entry *ce = istate->cache[i];
4143
ce_path_match(istate, ce, pathspec, seen);

0 commit comments

Comments
 (0)