Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix interpretation of glob patterns in .ocamlformat-ignore under Windows #2206

Merged
merged 3 commits into from
Dec 28, 2022
Merged

Fix interpretation of glob patterns in .ocamlformat-ignore under Windows #2206

merged 3 commits into from
Dec 28, 2022

Conversation

nojb
Copy link
Contributor

@nojb nojb commented Nov 5, 2022

Fixes #1773

ocaml-re has a flag ~match_backslashes:true which means that forward backslashes in the pattern will match both forward and backward backslashes in the matched filename. But it gets a bit tricky because backward slashes in the pattern will still act as normal backslashes (escaping the following character), so we need to make sure there are no backward slashes in the pattern before building the regexp.

All in all, an ugly solution, but am not sure we can do much better with ocaml-re's current API.

Copy link
Collaborator

@gpetiot gpetiot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks good to me, but do you have a minimal example we could add to the tests to try this behavior on windows?

nojb and others added 3 commits December 28, 2022 18:19
@gpetiot gpetiot changed the title Fix interpretation of glob patterns under Windows Fix interpretation of glob patterns in .ocamlformat-ignore under Windows Dec 28, 2022
@gpetiot gpetiot merged commit 3b4915f into ocaml-ppx:main Dec 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug: .ocamlformat-ignore glob patterns do not work on Windows
3 participants