Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@AlliBalliBaba
Copy link
Contributor

@AlliBalliBaba AlliBalliBaba commented Dec 15, 2025

@e-dant this is how much code would be necessary for a custom pattern match algorithm (without dependencies).

It's ~140 lines of code with some test cases. If something like this works for you, I could also try integrating it into the actual watcher. Not very familiar with C++, so this could probably also be done simpler or more performant.

@e-dant
Copy link
Owner

e-dant commented Dec 30, 2025

This is good work, but I wonder if it would be more fruitful to copy musl's fnmatch implementation and add globstar support and brace expansion.

The problems we have to overcome, as I understand it, are:

  • A very well tested (and simple) base implementation
  • All the stuff fnmatch has, plus globstar and brace expansion
  • Identical (or at least expected) behavior across platforms (beware of Windows here, I'm not even sure there's a "right" answer for some of the stuff in windows paths)

Starting with musl's fnmatch has the benefit of inheriting a simple, world-class implementation which has been relied upon and tested in practice.

I know that the idea of copying code from a libc is a bit gross, but I'm not sure if there's a way to add globstar support without doing that.

@AlliBalliBaba
Copy link
Contributor Author

You mean this fnmatch implementation?

@e-dant e-dant mentioned this pull request Jan 6, 2026
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