Add watch_filtered, filtering paths to watch - #950
Closed
daandemeyer wants to merge 1 commit into
Closed
Conversation
Contributor
Author
|
@JohnTitor Any chance you could enable workflows for this PR? The workflows don't run on my fork so I need them enabled here to make sure windows and macos work as expected. |
Member
|
Triggered! |
daandemeyer
force-pushed
the
push-xtzypqtzstty
branch
from
July 7, 2026 11:08
32d20b2 to
3d451c0
Compare
Contributor
Author
|
@JohnTitor Hmm seems you need to reapprove every single time. I'll see if I can find some trivial fix that can already land so I don't have to ask every time |
Contributor
Author
|
Opened #951, if you merge that one CI will start working automatically here without needing your approval every time. |
daandemeyer
force-pushed
the
push-xtzypqtzstty
branch
4 times, most recently
from
July 9, 2026 10:52
2e2a7ad to
3f6822b
Compare
daandemeyer
marked this pull request as ready for review
July 9, 2026 10:53
daandemeyer
force-pushed
the
push-xtzypqtzstty
branch
4 times, most recently
from
July 9, 2026 15:41
6eab4f4 to
43cf792
Compare
Contributor
Author
|
Should be ready for review now, includes two other commits which I've split out into separate PRs. Will rebase this pr once those are merged. It's a lot of code, but a lot of it is tests, happy to split up into separate commits or PRs if that's preferred. |
daandemeyer
force-pushed
the
push-xtzypqtzstty
branch
from
July 10, 2026 22:50
43cf792 to
b245e17
Compare
Adds `WatchFilter` and `Watcher::watch_filtered`, allowing directories to be excluded when setting up a watch. Implemented for the inotify, fsevents, kqueue, windows, poll, and null backends, with filter support plumbed through `Watcher::update_paths`, `notify-debouncer-full`, and the `FileIdCache` API. The filter gates directories only: walk-based backends prune excluded directories at scan time and gate directories discovered while watching; FSEvents and Windows suppress matching events at delivery time. File watches are never affected. Two restrictions keep the semantics simple and the implementation small: - Watching a directory the filter itself rejects returns the new `ErrorKind::PathExcluded` and changes nothing. Symlink roots are checked against their resolved target too. - A directory watch carrying a filter must not overlap another directory watch in either direction; such calls are refused with an error. Filters are never merged across watches, so each watch entry carries exactly one filter. Accept-all watches keep the existing overlap semantics, file watches never conflict, and re-watching the same path still replaces the watch (`WatchFilter::same_filter` identity makes an identical re-watch a no-op). Based on the filter-watch-targets branch: - Add `watch_filtered`, filtering paths to watch. - Add fsevent support and filter newly added paths too. - Add support for watch_filtered to Windows. - Add filtered watch implementation for kqueue. Co-authored-by: Hugo van der Wijst <hvanderwijst@tesla.com> Signed-off-by: Daan De Meyer <daan@amutable.com>
daandemeyer
force-pushed
the
push-xtzypqtzstty
branch
from
July 24, 2026 19:50
b245e17 to
aea1a52
Compare
Contributor
Author
|
Closing so I can open other prs |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds
WatchFilterandWatcher::watch_filtered, allowing directories to be excluded when setting up a watch. Implemented for the inotify, fsevents, kqueue, windows, poll, and null backends, with filter support plumbed throughWatcher::update_paths,notify-debouncer-full, and theFileIdCacheAPI.The filter gates directories only: walk-based backends prune excluded directories at scan time and gate directories discovered while watching; FSEvents and Windows suppress matching events at delivery time. File watches are never affected.
Two restrictions keep the semantics simple and the implementation small:
ErrorKind::PathExcludedand changes nothing. Symlink roots are checked against their resolved target too.WatchFilter::same_filteridentity makes an identical re-watch a no-op).Based on the filter-watch-targets branch:
watch_filtered, filtering paths to watch.