* This is an inexact early pruning of any recursive directory * reading - if the path cannot possibly be in the pathspec, * return true, and we'll skip it early. */
| 2221 | * return true, and we'll skip it early. |
| 2222 | */ |
| 2223 | static int simplify_away(const char *path, int pathlen, |
| 2224 | const struct pathspec *pathspec) |
| 2225 | { |
| 2226 | int i; |
| 2227 | |
| 2228 | if (!pathspec || !pathspec->nr) |
| 2229 | return 0; |
| 2230 | |
| 2231 | GUARD_PATHSPEC(pathspec, |
| 2232 | PATHSPEC_FROMTOP | |
| 2233 | PATHSPEC_MAXDEPTH | |
| 2234 | PATHSPEC_LITERAL | |
| 2235 | PATHSPEC_GLOB | |
| 2236 | PATHSPEC_ICASE | |
| 2237 | PATHSPEC_EXCLUDE | |
| 2238 | PATHSPEC_ATTR); |
| 2239 | |
| 2240 | for (i = 0; i < pathspec->nr; i++) { |
| 2241 | const struct pathspec_item *item = &pathspec->items[i]; |
| 2242 | int len = item->nowildcard_len; |
| 2243 | |
| 2244 | if (len > pathlen) |
| 2245 | len = pathlen; |
| 2246 | if (!ps_strncmp(item, item->match, path, len)) |
| 2247 | return 0; |
| 2248 | } |
| 2249 | |
| 2250 | return 1; |
| 2251 | } |
| 2252 | |
| 2253 | /* |
| 2254 | * This function tells us whether an excluded path matches a |
no test coverage detected