-
-
Notifications
You must be signed in to change notification settings - Fork 609
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(#2468): always apply filters to subdirectories #2537
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch!
This looks correct and will now correctly handle closed refreshes. However... we're now watching .git/*
directories. We'll need to somehow apply the exclusions that are present elsewhere.
Testing branch vs master:
: ; diff --unified=1000 <(sed -e 's/.*watcher] //g' /tmp/ma.log) <(sed -e 's/.*watcher] //g' /tmp/br.log)
--- /proc/self/fd/11 2023-11-19 15:07:11.978193749 +1100
+++ /proc/self/fd/12 2023-11-19 15:07:11.974860405 +1100
@@ -1,33 +1,48 @@
Watcher:new '/home/alex/src/nvim-tree/r/2468' nil
Event:new '/home/alex/src/nvim-tree/r/2468'
Event:start '/home/alex/src/nvim-tree/r/2468'
git start
Watcher:new '/home/alex/src/nvim-tree/r/2468/.git' { "FETCH_HEAD", "HEAD", "HEAD.lock", "config", "index" }
Event:new '/home/alex/src/nvim-tree/r/2468/.git'
Event:start '/home/alex/src/nvim-tree/r/2468/.git'
Watcher:new '/home/alex/src/nvim-tree/r/2468/n' nil
Event:new '/home/alex/src/nvim-tree/r/2468/n'
Event:start '/home/alex/src/nvim-tree/r/2468/n'
Watcher:new '/home/alex/src/nvim-tree/r/2468/n/1' nil
Event:new '/home/alex/src/nvim-tree/r/2468/n/1'
Event:start '/home/alex/src/nvim-tree/r/2468/n/1'
Watcher:new '/home/alex/src/nvim-tree/r/2468/n/2' nil
Event:new '/home/alex/src/nvim-tree/r/2468/n/2'
Event:start '/home/alex/src/nvim-tree/r/2468/n/2'
Watcher:new '/home/alex/src/nvim-tree/r/2468/n/3' nil
Event:new '/home/alex/src/nvim-tree/r/2468/n/3'
Event:start '/home/alex/src/nvim-tree/r/2468/n/3'
Watcher:new '/home/alex/src/nvim-tree/r/2468/i' nil
Event:new '/home/alex/src/nvim-tree/r/2468/i'
Event:start '/home/alex/src/nvim-tree/r/2468/i'
+Watcher:new '/home/alex/src/nvim-tree/r/2468/.git/branches' nil
+Event:new '/home/alex/src/nvim-tree/r/2468/.git/branches'
+Event:start '/home/alex/src/nvim-tree/r/2468/.git/branches'
+Watcher:new '/home/alex/src/nvim-tree/r/2468/.git/hooks' nil
+Event:new '/home/alex/src/nvim-tree/r/2468/.git/hooks'
+Event:start '/home/alex/src/nvim-tree/r/2468/.git/hooks'
+Watcher:new '/home/alex/src/nvim-tree/r/2468/.git/info' nil
+Event:new '/home/alex/src/nvim-tree/r/2468/.git/info'
+Event:start '/home/alex/src/nvim-tree/r/2468/.git/info'
+Watcher:new '/home/alex/src/nvim-tree/r/2468/.git/objects' nil
+Event:new '/home/alex/src/nvim-tree/r/2468/.git/objects'
+Event:start '/home/alex/src/nvim-tree/r/2468/.git/objects'
+Watcher:new '/home/alex/src/nvim-tree/r/2468/.git/refs' nil
+Event:new '/home/alex/src/nvim-tree/r/2468/.git/refs'
+Event:start '/home/alex/src/nvim-tree/r/2468/.git/refs'
Watcher:new '/home/alex/src/nvim-tree/r/2468/i/1' nil
Event:new '/home/alex/src/nvim-tree/r/2468/i/1'
Event:start '/home/alex/src/nvim-tree/r/2468/i/1'
Watcher:new '/home/alex/src/nvim-tree/r/2468/i/2' nil
Event:new '/home/alex/src/nvim-tree/r/2468/i/2'
Event:start '/home/alex/src/nvim-tree/r/2468/i/2'
Watcher:new '/home/alex/src/nvim-tree/r/2468/i/3' nil
Event:new '/home/alex/src/nvim-tree/r/2468/i/3'
Event:start '/home/alex/src/nvim-tree/r/2468/i/3'
Watcher:destroy '/home/alex/src/nvim-tree/r/2468/i'
Event:destroy '/home/alex/src/nvim-tree/r/2468/i'
Not sure what the correct behavior should be, I did some tests and the watchers are triggered for |
I see. I think I had some incorrect assumptions around existing behaviour. The files that trigger a full refresh are the curated list: nvim-tree.lua/lua/nvim-tree/git/init.lua Line 22 in 28c3980
These directories are treated like any other and thus shouldn't result in any performance issues. I'm happy if you are. |
Closes #2468
I might have found a fix for #2468, and if so it's a really simple one. From my tests it seems to apply correctly all filters to all subdirs, not sure about the resource leaks but they should go together as well.