Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions match.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ func (p pattern) match(testPath string) (bool, error) {
// Normalize Windows-style path separators to forward slashes
testPath = filepath.ToSlash(testPath)

// Paths are relative to the repository root, so "./foo" is the same as "foo"
testPath = strings.TrimPrefix(testPath, "./")

if p.leftAnchoredLiteral {
prefix := p.pattern

Expand Down
16 changes: 16 additions & 0 deletions testdata/patterns.json
Original file line number Diff line number Diff line change
Expand Up @@ -331,5 +331,21 @@
"vllm/v1/worker/^cpu": true,
"vllm/v1/worker/cpu": false
}
},
{
"name": "paths with leading dot-slash",
"pattern": "/foo/",
"paths": {
"./foo/bar": true,
"./bar/foo/baz": false
}
},
{
"name": "anchored wildcard pattern with leading dot-slash path",
"pattern": "/src/*.go",
"paths": {
"./src/a.go": true,
"./lib/src/a.go": false
}
}
]