@@ -132,7 +132,7 @@ function Explorer:reload(node, git_status)
132
132
133
133
local abs = utils .path_join { cwd , name }
134
134
--- @type uv.fs_stat.result | nil
135
- local stat = vim .loop .fs_stat (abs )
135
+ local stat = vim .loop .fs_lstat (abs )
136
136
137
137
local filter_reason = self .filters :should_filter_as_reason (abs , stat , filter_status )
138
138
if filter_reason == FILTER_REASON .none then
@@ -241,17 +241,17 @@ function Explorer:refresh_parent_nodes_for_path(path)
241
241
-- collect parent nodes from the top down
242
242
local parent_nodes = {}
243
243
NodeIterator .builder ({ self })
244
- :recursor (function (node )
245
- return node .nodes
246
- end )
247
- :applier (function (node )
248
- local abs_contains = node .absolute_path and path :find (node .absolute_path , 1 , true ) == 1
249
- local link_contains = node .link_to and path :find (node .link_to , 1 , true ) == 1
250
- if abs_contains or link_contains then
251
- table.insert (parent_nodes , node )
252
- end
253
- end )
254
- :iterate ()
244
+ :recursor (function (node )
245
+ return node .nodes
246
+ end )
247
+ :applier (function (node )
248
+ local abs_contains = node .absolute_path and path :find (node .absolute_path , 1 , true ) == 1
249
+ local link_contains = node .link_to and path :find (node .link_to , 1 , true ) == 1
250
+ if abs_contains or link_contains then
251
+ table.insert (parent_nodes , node )
252
+ end
253
+ end )
254
+ :iterate ()
255
255
256
256
-- refresh in order; this will expand groups as needed
257
257
for _ , node in ipairs (parent_nodes ) do
@@ -354,7 +354,7 @@ function Explorer:populate_children(handle, cwd, node, git_status, parent)
354
354
})
355
355
356
356
while true do
357
- local name , t = vim .loop .fs_scandir_next (handle )
357
+ local name , _ = vim .loop .fs_scandir_next (handle )
358
358
if not name then
359
359
break
360
360
end
@@ -365,15 +365,17 @@ function Explorer:populate_children(handle, cwd, node, git_status, parent)
365
365
local profile = log .profile_start (" populate_children %s" , abs )
366
366
367
367
--- @type uv.fs_stat.result | nil
368
- local stat = vim .loop .fs_stat (abs )
368
+ local stat = vim .loop .fs_lstat (abs )
369
369
local filter_reason = parent .filters :should_filter_as_reason (abs , stat , filter_status )
370
370
if filter_reason == FILTER_REASON .none and not nodes_by_path [abs ] then
371
+ -- Type must come from fs_stat and not fs_scandir_next to maintain sshfs compatibility
372
+ local type = stat and stat .type or nil
371
373
local child = nil
372
- if t == " directory" and vim .loop .fs_access (abs , " R" ) then
374
+ if type == " directory" and vim .loop .fs_access (abs , " R" ) then
373
375
child = builders .folder (node , abs , name , stat )
374
- elseif t == " file" then
376
+ elseif type == " file" then
375
377
child = builders .file (node , abs , name , stat )
376
- elseif t == " link" then
378
+ elseif type == " link" then
377
379
local link = builders .link (node , abs , name , stat )
378
380
if link .link_to ~= nil then
379
381
child = link
@@ -437,16 +439,16 @@ end
437
439
--- @param projects table
438
440
function Explorer :refresh_nodes (projects )
439
441
Iterator .builder ({ self })
440
- :applier (function (n )
441
- if n .nodes then
442
- local toplevel = git .get_toplevel (n .cwd or n .link_to or n .absolute_path )
443
- self :reload (n , projects [toplevel ] or {})
444
- end
445
- end )
446
- :recursor (function (n )
447
- return n .group_next and { n .group_next } or (n .open and n .nodes )
448
- end )
449
- :iterate ()
442
+ :applier (function (n )
443
+ if n .nodes then
444
+ local toplevel = git .get_toplevel (n .cwd or n .link_to or n .absolute_path )
445
+ self :reload (n , projects [toplevel ] or {})
446
+ end
447
+ end )
448
+ :recursor (function (n )
449
+ return n .group_next and { n .group_next } or (n .open and n .nodes )
450
+ end )
451
+ :iterate ()
450
452
end
451
453
452
454
local event_running = false
0 commit comments