neovim

Neovim text editor
git clone https://git.dasho.dev/neovim.git
Log | Files | Refs | README

commit 6dc0eb9f41e6453fe003dd3a28c58b701fd003c9
parent dc692f553aae367a03f286e0d59561247941f96c
Author: dundargoc <gocdundar@gmail.com>
Date:   Wed,  1 Jan 2025 13:13:40 +0100

fix(vim.fs.abspath): correctly handle UNC paths

Diffstat:
Mruntime/lua/vim/fs.lua | 2+-
Mtest/functional/lua/fs_spec.lua | 5+++--
2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/runtime/lua/vim/fs.lua b/runtime/lua/vim/fs.lua @@ -725,7 +725,7 @@ function M.abspath(path) prefix, path = split_windows_path(path) end - if vim.startswith(path, '/') then + if prefix == '//' or vim.startswith(path, '/') then -- Path is already absolute, do nothing return prefix .. path end diff --git a/test/functional/lua/fs_spec.lua b/test/functional/lua/fs_spec.lua @@ -361,8 +361,8 @@ describe('vim.fs', function() end) -- Opts required for testing posix paths and win paths - local posix_opts = is_os('win') and { win = false } or {} - local win_opts = is_os('win') and {} or { win = true } + local posix_opts = { win = false } + local win_opts = { win = true } it('preserves leading double slashes in POSIX paths', function() eq('//foo', vim.fs.normalize('//foo', posix_opts)) @@ -483,6 +483,7 @@ describe('vim.fs', function() if is_os('win') then eq([[C:/foo]], vim.fs.abspath([[C:\foo]])) eq([[C:/foo/../.]], vim.fs.abspath([[C:\foo\..\.]])) + eq('//foo/bar', vim.fs.abspath('\\\\foo\\bar')) else eq('/foo/../.', vim.fs.abspath('/foo/../.')) eq('/foo/bar', vim.fs.abspath('/foo/bar'))