Skip to content

Commit 899ed45

Browse files
committed
fix(watcher): only purge on subsequent setup calls, add git_purge log
1 parent 0cd8ac4 commit 899ed45

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

Diff for: lua/nvim-tree.lua

+8-9
Original file line numberDiff line numberDiff line change
@@ -794,20 +794,19 @@ function M.setup(conf)
794794
end
795795

796796
setup_autocommands(opts)
797-
require("nvim-tree.watcher").purge_watchers()
798797

799798
if not M.setup_called then
799+
-- first call to setup
800800
setup_vim_commands()
801-
end
802-
803-
if M.setup_called then
801+
else
802+
-- subsequent calls to setup
803+
require("nvim-tree.watcher").purge_watchers()
804804
view.close_all_tabs()
805805
view.abandon_all_windows()
806-
end
807-
808-
if M.setup_called and core.get_explorer() ~= nil then
809-
git.purge_state()
810-
TreeExplorer = nil
806+
if core.get_explorer() ~= nil then
807+
git.purge_state()
808+
TreeExplorer = nil
809+
end
811810
end
812811

813812
M.setup_called = true

Diff for: lua/nvim-tree/git/init.lua

+1
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,7 @@ function M.load_project_status(cwd)
173173
end
174174

175175
function M.purge_state()
176+
log.line("git", "purge_state")
176177
M.projects = {}
177178
M.cwd_to_project_root = {}
178179
end

0 commit comments

Comments
 (0)