| ... | ... | @@ -1510,12 +1510,22 @@ const Filter = struct { |
| 1510 | 1510 | // Check if any included paths are parent directories of sub_path. |
| 1511 | 1511 | var dirname = sub_path; |
| 1512 | 1512 | while (std.fs.path.dirname(dirname)) |next_dirname| { |
| 1513 | | if (self.include_paths.contains(sub_path)) return true; |
| 1513 | if (self.include_paths.contains(next_dirname)) return true; |
| 1514 | 1514 | dirname = next_dirname; |
| 1515 | 1515 | } |
| 1516 | 1516 | |
| 1517 | 1517 | return false; |
| 1518 | 1518 | } |
| 1519 | |
| 1520 | test includePath { |
| 1521 | const gpa = std.testing.allocator; |
| 1522 | var filter: Filter = .{}; |
| 1523 | defer filter.include_paths.deinit(gpa); |
| 1524 | |
| 1525 | try filter.include_paths.put(gpa, "src", {}); |
| 1526 | try std.testing.expect(filter.includePath("src/core/unix/SDL_poll.c")); |
| 1527 | try std.testing.expect(!filter.includePath(".gitignore")); |
| 1528 | } |
| 1519 | 1529 | }; |
| 1520 | 1530 | |
| 1521 | 1531 | pub fn depDigest( |
| ... | ... | @@ -1556,3 +1566,7 @@ const git = @import("Fetch/git.zig"); |
| 1556 | 1566 | const Package = @import("../Package.zig"); |
| 1557 | 1567 | const Manifest = Package.Manifest; |
| 1558 | 1568 | const ErrorBundle = std.zig.ErrorBundle; |
| 1569 | |
| 1570 | test { |
| 1571 | _ = Filter; |
| 1572 | } |