Skip to content

Commit 8405ecf

Browse files
authored
revert(#2794): sshfs compatibility (#2920)
* refactor(#2875): multi instance renderer: remove unused code * Revert "fix(#2794): sshfs compatibility (#2893)" This reverts commit 2d6e64d.
1 parent 0ae9ad4 commit 8405ecf

File tree

2 files changed

+7
-15
lines changed

2 files changed

+7
-15
lines changed

Diff for: lua/nvim-tree/actions/fs/remove-file.lua

+2-7
Original file line numberDiff line numberDiff line change
@@ -57,18 +57,13 @@ local function remove_dir(cwd)
5757
end
5858

5959
while true do
60-
local name, _ = vim.loop.fs_scandir_next(handle)
60+
local name, t = vim.loop.fs_scandir_next(handle)
6161
if not name then
6262
break
6363
end
6464

6565
local new_cwd = utils.path_join { cwd, name }
66-
67-
-- Type must come from fs_stat and not fs_scandir_next to maintain sshfs compatibility
68-
local stat = vim.loop.fs_stat(new_cwd)
69-
local type = stat and stat.type or nil
70-
71-
if type == "directory" then
66+
if t == "directory" then
7267
local success = remove_dir(new_cwd)
7368
if not success then
7469
return false

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

+5-8
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ function Explorer:reload(node, git_status)
125125
})
126126

127127
while true do
128-
local name, _ = vim.loop.fs_scandir_next(handle)
128+
local name, t = vim.loop.fs_scandir_next(handle)
129129
if not name then
130130
break
131131
end
@@ -138,14 +138,11 @@ function Explorer:reload(node, git_status)
138138
if filter_reason == FILTER_REASON.none then
139139
remain_childs[abs] = true
140140

141-
-- Type must come from fs_stat and not fs_scandir_next to maintain sshfs compatibility
142-
local type = stat and stat.type or nil
143-
144141
-- Recreate node if type changes.
145142
if nodes_by_path[abs] then
146143
local n = nodes_by_path[abs]
147144

148-
if n.type ~= type then
145+
if n.type ~= t then
149146
utils.array_remove(node.nodes, n)
150147
explorer_node.node_destroy(n)
151148
nodes_by_path[abs] = nil
@@ -154,11 +151,11 @@ function Explorer:reload(node, git_status)
154151

155152
if not nodes_by_path[abs] then
156153
local new_child = nil
157-
if type == "directory" and vim.loop.fs_access(abs, "R") and Watcher.is_fs_event_capable(abs) then
154+
if t == "directory" and vim.loop.fs_access(abs, "R") and Watcher.is_fs_event_capable(abs) then
158155
new_child = builders.folder(node, abs, name, stat)
159-
elseif type == "file" then
156+
elseif t == "file" then
160157
new_child = builders.file(node, abs, name, stat)
161-
elseif type == "link" then
158+
elseif t == "link" then
162159
local link = builders.link(node, abs, name, stat)
163160
if link.link_to ~= nil then
164161
new_child = link

0 commit comments

Comments
 (0)