Skip to content

revert(#2794): sshfs compatibility #2920

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

Merged
merged 2 commits into from
Sep 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 2 additions & 7 deletions lua/nvim-tree/actions/fs/remove-file.lua
Original file line number Diff line number Diff line change
Expand Up @@ -57,18 +57,13 @@ local function remove_dir(cwd)
end

while true do
local name, _ = vim.loop.fs_scandir_next(handle)
local name, t = vim.loop.fs_scandir_next(handle)
if not name then
break
end

local new_cwd = utils.path_join { cwd, name }

-- Type must come from fs_stat and not fs_scandir_next to maintain sshfs compatibility
local stat = vim.loop.fs_stat(new_cwd)
local type = stat and stat.type or nil

if type == "directory" then
if t == "directory" then
local success = remove_dir(new_cwd)
if not success then
return false
Expand Down
120 changes: 0 additions & 120 deletions lua/nvim-tree/explorer/explore.lua

This file was deleted.

13 changes: 5 additions & 8 deletions lua/nvim-tree/explorer/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ function Explorer:reload(node, git_status)
})

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

-- Type must come from fs_stat and not fs_scandir_next to maintain sshfs compatibility
local type = stat and stat.type or nil

-- Recreate node if type changes.
if nodes_by_path[abs] then
local n = nodes_by_path[abs]

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

if not nodes_by_path[abs] then
local new_child = nil
if type == "directory" and vim.loop.fs_access(abs, "R") and Watcher.is_fs_event_capable(abs) then
if t == "directory" and vim.loop.fs_access(abs, "R") and Watcher.is_fs_event_capable(abs) then
new_child = builders.folder(node, abs, name, stat)
elseif type == "file" then
elseif t == "file" then
new_child = builders.file(node, abs, name, stat)
elseif type == "link" then
elseif t == "link" then
local link = builders.link(node, abs, name, stat)
if link.link_to ~= nil then
new_child = link
Expand Down
Loading