Repository navigation
Match paths with a leading ./ - #54
Open
Bortlesboat wants to merge 2 commits into
Open
Bortlesboat wants to merge 2 commits into
Bortlesboat wants to merge 2 commits into
Conversation
hmarr
reviewed
Oct 26, 2026
Comment on lines
+344
to
+349
| "name": "unanchored pattern with leading dot-slash path", | ||
| "pattern": "*.txt", | ||
| "paths": { | ||
| "./foo.txt": true, | ||
| "./foo/bar.txt": true, | ||
| "./foo.go": false |
Owner
There was a problem hiding this comment.
These cases pass without the fix: *.txt compiles to \A(?:.+/)?..., and the leading .+/ already matches the ./. So only the /foo/ block above exercises the change, and that only covers the literal-prefix fast path.
Could you swap this for an anchored pattern that goes through the regex path? Something like:
{
"name": "anchored wildcard pattern with leading dot-slash path",
"pattern": "/src/*.go",
"paths": {
"./src/a.go": true,
"./lib/src/a.go": false
}
}Generated by Claude Code
Author
There was a problem hiding this comment.
Good catch, swapped it for /src/*.go. Confirmed it fails without the match.go change and passes with it.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Paths like
./src/file.gonever matched anchored rules, socodeowners ./src/file.gofell through to the*rule (or showed unowned) whilecodeowners src/file.goworked. This strips a leading./before matching, since paths are relative to the repo root anyway. It also covers.\src\file.goon Windows, because separators are normalised first.Fixes #17