Skip to content

Commit 8d2c3c6

Browse files
committed
Fix failures to list self-referenced symlink
Previous fern.vim can't list file entries containing even one self-referenced symlink because a `find` command invoked in the background emits an error such as `Too many levels of symbolic links` by the `-follow` option. The option tries to dereference symlinks in listing files. But we only need to dereference symlinks on the command line, but not dereference symlinks in listing files. So we should use the `-H` option, which doesn't dereference symlinks except on the command line, instead of the `-follow` option. This problem happens on Linux, but not macOS. The `find` command installed in macOS by default doesn't emit errors in the situation above.
1 parent 5403555 commit 8d2c3c6

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

autoload/fern/scheme/file/util.vim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ endif
2424
if !s:is_windows && executable('find')
2525
function! fern#scheme#file#util#list_entries_find(path, token) abort
2626
let l:Profile = fern#profile#start('fern#scheme#file#util#list_entries_find')
27-
return s:Process.start(['find', a:path, '-follow', '-maxdepth', '1'], { 'token': a:token, 'reject_on_failure': 1 })
27+
return s:Process.start(['find', '-H', a:path, '-maxdepth', '1'], { 'token': a:token, 'reject_on_failure': 1 })
2828
\.catch({ v -> s:Promise.reject(join(v.stderr, "\n")) })
2929
\.then({ v -> v.stdout })
3030
\.then(s:AsyncLambda.filter_f({ v -> !empty(v) && v !=# a:path }))

0 commit comments

Comments
 (0)