Exclude items by shell pattern as well as by name
Docs / docs (push) Canceled after 0s
Docs / deploy (push) Canceled after 0s

Patterns such as `.*` or `@*` are matched against an item's own name
with `fnmatch`, in the same places as excluded names: resolving a
tree, extending a watch to a directory that appears later, and
delivering events. Dependents that prune large trees can now skip
whole families of directories without listing each name.
This commit is contained in:
T. R. Bernstein
2026-09-16 11:21:45 +02:00
parent 442053eae2
commit 8af25be549
10 changed files with 154 additions and 22 deletions
@@ -24,4 +24,14 @@ struct DirectoryResolverTests {
#expect(directories.map { $0.description } == [dir])
}
}
@Test func doesNotDescendIntoDirectoriesMatchingAnExcludedPattern() async throws {
try await withTempDir { dir in
let excludedSubdirectory = "\(dir)/@eaDir/Inside"
try FileManager.default.createDirectory(atPath: excludedSubdirectory, withIntermediateDirectories: true)
let directories = try await DirectoryResolver.resolve([dir], excluding: ExclusionList(patterns: ["@*"]))
#expect(directories.map { $0.description } == [dir])
}
}
}