Code

grep: use match_pathspec_depth() for cache/worktree grepping
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>
Wed, 15 Dec 2010 15:02:52 +0000 (22:02 +0700)
committerJunio C Hamano <gitster@pobox.com>
Fri, 17 Dec 2010 22:42:05 +0000 (14:42 -0800)
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/grep.c

index 4179af8a448b4b5390dd8f4d047c58889fe5d8d9..fbc7d02dbe411d857fca93bb9dd92ae565412667 100644 (file)
@@ -595,7 +595,7 @@ static int grep_cache(struct grep_opt *opt, const struct pathspec *pathspec, int
                struct cache_entry *ce = active_cache[nr];
                if (!S_ISREG(ce->ce_mode))
                        continue;
-               if (!pathspec_matches(pathspec->raw, ce->name, opt->max_depth))
+               if (!match_pathspec_depth(pathspec, ce->name, ce_namelen(ce), 0, NULL))
                        continue;
                /*
                 * If CE_VALID is on, we assume worktree file and its cache entry