Skip to content

Use doublestar for glob matching#55

Open
shaxbee wants to merge 3 commits intocespare:mainfrom
shaxbee:master
Open

Use doublestar for glob matching#55
shaxbee wants to merge 3 commits intocespare:mainfrom
shaxbee:master

Conversation

@shaxbee
Copy link

@shaxbee shaxbee commented Dec 17, 2018

Enables glob patterns containing ** eg. **/*.go

@shaxbee
Copy link
Author

shaxbee commented May 2, 2019

Noticed excludePrefix wasn't working with glob matcher. Added implementation and tests as well.

@shaxbee
Copy link
Author

shaxbee commented Aug 14, 2019

@cespare could you kindly review?

@shaxbee
Copy link
Author

shaxbee commented May 1, 2020

@cespare Is there anything preventing this PR from being reviewed?

@carrete
Copy link

carrete commented May 1, 2020

@shaxbee You may want to check out https://github.com/cortesi/modd

Copy link
Owner

@cespare cespare left a comment

Choose a reason for hiding this comment

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

@cespare Is there anything preventing this PR from being reviewed?

Sorry, I find it hard to get excited about this because I've never needed this feature (and because it adds a dependency).

This would also need documentation.

case err != nil:
return false
case matches:
return true
Copy link
Owner

Choose a reason for hiding this comment

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

The documentation for the ExcludePrefix method says:

// ExcludePrefix returns whether all paths with this prefix cannot match.
// It is allowed to return false negatives but not false positives.

That is not what this function implements. For example, if the pattern is **/, that matches the prefix a/ but does not match the path a/b.txt. So this would incorrectly exclude a/b.txt from the watch.

It's not immediately obvious to me how to fix this problem. I designed the ExcludePrefix mechanism mostly with regexp matching in mind.

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.

3 participants