Skip to content

Commit 2ed2437

Browse files
pcloudsgitster
authored andcommitted
grep: use match_pathspec_depth() for cache/worktree grepping
Signed-off-by: Nguyễn Thái Ngọc Duy <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent f34bbc1 commit 2ed2437

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

builtin/grep.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -591,7 +591,7 @@ static int grep_cache(struct grep_opt *opt, const struct pathspec *pathspec, int
591591
struct cache_entry *ce = active_cache[nr];
592592
if (!S_ISREG(ce->ce_mode))
593593
continue;
594-
if (!pathspec_matches(pathspec->raw, ce->name, opt->max_depth))
594+
if (!match_pathspec_depth(pathspec, ce->name, ce_namelen(ce), 0, NULL))
595595
continue;
596596
/*
597597
* If CE_VALID is on, we assume worktree file and its cache entry

0 commit comments

Comments
 (0)