|
6 | 6 | * Junio Hamano, 2005-2006
|
7 | 7 | */
|
8 | 8 | #include "cache.h"
|
| 9 | +#include "virtualfilesystem.h" |
9 | 10 | #include "config.h"
|
10 | 11 | #include "dir.h"
|
11 | 12 | #include "object-store.h"
|
@@ -1418,6 +1419,17 @@ enum pattern_match_result path_matches_pattern_list(
|
1418 | 1419 | int result = NOT_MATCHED;
|
1419 | 1420 | size_t slash_pos;
|
1420 | 1421 |
|
| 1422 | + /* |
| 1423 | + * The virtual file system data is used to prevent git from traversing |
| 1424 | + * any part of the tree that is not in the virtual file system. Return |
| 1425 | + * 1 to exclude the entry if it is not found in the virtual file system, |
| 1426 | + * else fall through to the regular excludes logic as it may further exclude. |
| 1427 | + */ |
| 1428 | + if (*dtype == DT_UNKNOWN) |
| 1429 | + *dtype = resolve_dtype(DT_UNKNOWN, istate, pathname, pathlen); |
| 1430 | + if (is_excluded_from_virtualfilesystem(pathname, pathlen, *dtype) > 0) |
| 1431 | + return 1; |
| 1432 | + |
1421 | 1433 | if (!pl->use_cone_patterns) {
|
1422 | 1434 | pattern = last_matching_pattern_from_list(pathname, pathlen, basename,
|
1423 | 1435 | dtype, pl, istate);
|
@@ -1691,8 +1703,20 @@ struct path_pattern *last_matching_pattern(struct dir_struct *dir,
|
1691 | 1703 | int is_excluded(struct dir_struct *dir, struct index_state *istate,
|
1692 | 1704 | const char *pathname, int *dtype_p)
|
1693 | 1705 | {
|
1694 |
| - struct path_pattern *pattern = |
1695 |
| - last_matching_pattern(dir, istate, pathname, dtype_p); |
| 1706 | + struct path_pattern *pattern; |
| 1707 | + |
| 1708 | + /* |
| 1709 | + * The virtual file system data is used to prevent git from traversing |
| 1710 | + * any part of the tree that is not in the virtual file system. Return |
| 1711 | + * 1 to exclude the entry if it is not found in the virtual file system, |
| 1712 | + * else fall through to the regular excludes logic as it may further exclude. |
| 1713 | + */ |
| 1714 | + if (*dtype_p == DT_UNKNOWN) |
| 1715 | + *dtype_p = resolve_dtype(DT_UNKNOWN, istate, pathname, strlen(pathname)); |
| 1716 | + if (is_excluded_from_virtualfilesystem(pathname, strlen(pathname), *dtype_p) > 0) |
| 1717 | + return 1; |
| 1718 | + |
| 1719 | + pattern = last_matching_pattern(dir, istate, pathname, dtype_p); |
1696 | 1720 | if (pattern)
|
1697 | 1721 | return pattern->flags & PATTERN_FLAG_NEGATIVE ? 0 : 1;
|
1698 | 1722 | return 0;
|
@@ -2257,6 +2281,8 @@ static enum path_treatment treat_path(struct dir_struct *dir,
|
2257 | 2281 | ignore_case);
|
2258 | 2282 | if (dtype != DT_DIR && has_path_in_index)
|
2259 | 2283 | return path_none;
|
| 2284 | + if (is_excluded_from_virtualfilesystem(path->buf, path->len, dtype) > 0) |
| 2285 | + return path_excluded; |
2260 | 2286 |
|
2261 | 2287 | /*
|
2262 | 2288 | * When we are looking at a directory P in the working tree,
|
@@ -2461,6 +2487,8 @@ static void add_path_to_appropriate_result_list(struct dir_struct *dir,
|
2461 | 2487 | /* add the path to the appropriate result list */
|
2462 | 2488 | switch (state) {
|
2463 | 2489 | case path_excluded:
|
| 2490 | + if (is_excluded_from_virtualfilesystem(path->buf, path->len, DT_DIR) > 0) |
| 2491 | + break; |
2464 | 2492 | if (dir->flags & DIR_SHOW_IGNORED)
|
2465 | 2493 | dir_add_name(dir, istate, path->buf, path->len);
|
2466 | 2494 | else if ((dir->flags & DIR_SHOW_IGNORED_TOO) ||
|
|
0 commit comments