Skip to content

Fix bug with incorrect handling of prefixes - #23

Merged
boyter merged 2 commits into
boyter:masterfrom
typesanitizer:vg/fix-prefix-bug
Apr 30, 2026
Merged

Fix bug with incorrect handling of prefixes#23
boyter merged 2 commits into
boyter:masterfrom
typesanitizer:vg/fix-prefix-bug

Conversation

@typesanitizer

@typesanitizer typesanitizer commented Apr 27, 2026

Copy link
Copy Markdown
Contributor

First commit adds a regression test,
second commit has a potential fix using filepath.Rel.

--- FAIL: TestMatchAbsoluteRejectsPathWithBasePrefixOnly (0.00s)
    match_test.go:293: unexpected match for path outside base directory; expected nil, got file.txt
FAIL
FAIL    github.com/boyter/gocodewalker/go-gitignore     0.287s
FAIL
@pr-insights pr-insights Bot added S/size Small change VL/complexity Very low complexity M/complexity Normal or medium complexity M/size Normal or medium sized change and removed S/size Small change VL/complexity Very low complexity labels Apr 27, 2026
@boyter

boyter commented Apr 27, 2026

Copy link
Copy Markdown
Owner

Is this similar to #22 ?

Just looking at the titles it seems to be yes... but not sure here. Will look though everything to confirm myself.

@typesanitizer

Copy link
Copy Markdown
Contributor Author

#22 seems to be about slash-vs-backslash differences in MatchIsDir and missing specific ignore files like .git/info/exclude.

This patch is a bit different; it's focused on the Absolute method.

@boyter
boyter merged commit 7bc7145 into boyter:master Apr 30, 2026
2 checks passed
@boyter

boyter commented Apr 30, 2026

Copy link
Copy Markdown
Owner

You are right. No idea what I was thinking. Thanks for the submission.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

M/complexity Normal or medium complexity M/size Normal or medium sized change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants