* This function tells us whether an excluded path matches a * list of "interesting" pathspecs. That is, whether a path matched * by any of the pathspecs could possibly be ignored by excluding * the specified path. This can happen if: * * 1. the path is mentioned explicitly in the pathspec * * 2. the path is a directory prefix of some element in the * pathspec */
| 2262 | * pathspec |
| 2263 | */ |
| 2264 | static int exclude_matches_pathspec(const char *path, int pathlen, |
| 2265 | const struct pathspec *pathspec) |
| 2266 | { |
| 2267 | int i; |
| 2268 | |
| 2269 | if (!pathspec || !pathspec->nr) |
| 2270 | return 0; |
| 2271 | |
| 2272 | GUARD_PATHSPEC(pathspec, |
| 2273 | PATHSPEC_FROMTOP | |
| 2274 | PATHSPEC_MAXDEPTH | |
| 2275 | PATHSPEC_LITERAL | |
| 2276 | PATHSPEC_GLOB | |
| 2277 | PATHSPEC_ICASE | |
| 2278 | PATHSPEC_EXCLUDE | |
| 2279 | PATHSPEC_ATTR); |
| 2280 | |
| 2281 | for (i = 0; i < pathspec->nr; i++) { |
| 2282 | const struct pathspec_item *item = &pathspec->items[i]; |
| 2283 | int len = item->nowildcard_len; |
| 2284 | |
| 2285 | if (len == pathlen && |
| 2286 | !ps_strncmp(item, item->match, path, pathlen)) |
| 2287 | return 1; |
| 2288 | if (len > pathlen && |
| 2289 | item->match[pathlen] == '/' && |
| 2290 | !ps_strncmp(item, item->match, path, pathlen)) |
| 2291 | return 1; |
| 2292 | } |
| 2293 | return 0; |
| 2294 | } |
| 2295 | |
| 2296 | static int get_index_dtype(struct index_state *istate, |
| 2297 | const char *path, int len) |
no test coverage detected