Skip to content

fix(tools): stop glob "*" matching across directories on Windows - #528

Merged
aandrew-me merged 1 commit into
aandrew-me:mainfrom
b84330808:fix/glob-windows-slash-match
Nov 6, 2026
Merged

aandrew-me merged 1 commit into
aandrew-me:mainfrom
b84330808:fix/glob-windows-slash-match

Conversation

@b84330808

Copy link
Copy Markdown
Contributor

The glob tool converts the pattern and each walked path to / and then calls filepath.Match. On Windows, filepath.Match only treats \ as a separator, so * also matches /: src/*.go returns src/nested/deep.go as well as src/helper.go.

Switching to path.Match makes the path-scoped case behave the same on every OS. TestGlobTool now also checks that src/*.go doesn't return the nested file; that check fails on Windows without the change and passes with it.

The glob tool converts both the pattern and the walked path to forward
slashes, then matched them with filepath.Match. On Windows,
filepath.Match only treats a backslash as a separator, so "*" and "?"
also matched "/": "src/*.go" returned src/nested/deep.go too.

Use path.Match, which always uses "/", so a path-scoped pattern matches
the same files on every platform.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@gitar-bot

gitar-bot Bot commented Nov 6, 2026 •

Copy link
Copy Markdown
Code Review ✅ Approved

🟡 Medium risk · Using path.Match for path-scoped globs prevents wildcard matches across directories, but may omit nested files from results on Windows.

Switches the glob tool from filepath.Match to path.Match so * no longer matches across directory separators on Windows, making src/*.go behave the same on every OS. TestGlobTool now verifies the nested file is excluded. No issues found.

Verification

Rules No rules evaluated

Functional validation Not enabled

Set up

For more verification details, comment gitar display:verbose.

Options

Auto-apply is off → Gitar will not commit updates to this branch.
Display: compact → Showing compact verification results.

Comment with these commands to change the behavior for this request:

Auto-apply Compact
gitar auto-apply:on         
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source

@aandrew-me
aandrew-me merged commit 65f2772 into aandrew-me:main Nov 6, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants