Skip to content

Commit 9312bb6

Browse files
Strum355claude
andcommitted
fix: handle glob patterns where excluded dir is first path component
Java's PathMatcher with glob:**/X/** does not match paths where X is the first component (e.g., __pycache__/foo.py). Add fallback matchers without the **/ prefix to handle this edge case. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent d0a6289 commit 9312bb6

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

src/main/java/io/github/guacsec/trustifyda/utils/WorkspaceUtils.java

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,17 @@ public static List<Path> filterByIgnorePatterns(
4343

4444
List<PathMatcher> matchers =
4545
ignorePatterns.stream()
46-
.map(p -> FileSystems.getDefault().getPathMatcher("glob:" + p))
46+
.flatMap(
47+
p -> {
48+
var fs = FileSystems.getDefault();
49+
java.util.stream.Stream.Builder<PathMatcher> b =
50+
java.util.stream.Stream.builder();
51+
b.add(fs.getPathMatcher("glob:" + p));
52+
if (p.startsWith("**/")) {
53+
b.add(fs.getPathMatcher("glob:" + p.substring(3)));
54+
}
55+
return b.build();
56+
})
4757
.toList();
4858

4959
return manifests.stream()

0 commit comments

Comments
 (0)