-
Notifications
You must be signed in to change notification settings - Fork 228
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
Feature request: Allow user-defined filtering before setting a watch #291
Comments
Hi, I like the idea of using the ignore crate, though maybe it's also worth to add some option of disabling symlinks? Would need some investigation how easy that could be implemented. At best we can find a solution that does not take much overhead and makes sense across systems (as symlinks on windows are kinda irrelevant ?). |
Regarding ignore: I'm not sure if we want to introduce this as a direct dependency but I'm also on the fence how we could implement this in the most user friendly way without adding another callback to allow setting your own filter implementation. One reason is that I'd only introduce this ignore api as an feature, though it's probably something many people might want. On the other side I personally dislike adding more callbacks as we really don't want to block in the core watcher implementation. |
Thanks for the response!
The specific use-case I'm having can't just blanket-ignore symlinks, unfortunately. Some of the directories in my
A large part of why I'm interested in using I understand not really wanting to add another dependency / callback / etc. for this, and that's fine with me ^^ I'm mostly just trying to avoid reimplementing In the short term, I can likely handle this via traversing the directory tree with |
This would be possible by simply filtering what to watch instead of filtering which symlinks to follow, wouldn't it ? So we don't need another filtering API besides the ignore filter. |
Yes! Filtering what to watch would solve the entirety of my current issues. |
Ok if you want you can add this as a PR against main so it'll be added to an upcoming v5-pre release. |
Also I'd probably want to add a "don't follow symlinks at all" option, which could come in handy. |
Oh an if you want to do this PR by yourself you could feature-gate a ignore dependency or add an example how you can utilize this with the new API. (possibly using a callback and stuffing ignore inside?) |
Hmm, after rethinking my wants, I think I really just need a "don't follow symlinks" in the end. I also couldn't come up with a good API that actually ended up working here :< I'll leave this open in case there's interest in implementing this in the future. |
#255 is related but is NOT the same thing.
I have a use-case in which I want to watch my entire
$HOME
. However, due to WINE prefixes and other circumstances, it turns out I have a bunch of symlinks into/
by accident. This is causing the inotify watcher to recurse through the entire directory tree and error out when it can't set a watch on something owned by root and not world-readable. It'd be nice to be able to filter out symlinks that specifically go to/
.Beyond this, it would be nice to be able to make something equivalent to
ignore
to ex. not open watches on anode_modules
folder or other ignored files.If this is worth adding, I'll try to put together a PR for this.
The text was updated successfully, but these errors were encountered: