fix: fs_watcher not started for .git folders (windows) (#2265)

This fixes the issue described in #2243, where the .git folder's path
ends on a weird character produced by `cygpath` when the newline
character is fed into it (when using shell=powershell)
This commit is contained in:
Anton Kriese 2023-06-12 07:44:52 +02:00 committed by GitHub
parent e0c7eb5044
commit f5804ce94e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -25,7 +25,7 @@ function M.get_toplevel(cwd)
if vim.fn.has "win32" == 1 then
-- msys2 git support
if has_cygpath then
toplevel = vim.fn.system("cygpath -w " .. vim.fn.shellescape(toplevel))
toplevel = vim.fn.system("cygpath -w " .. vim.fn.shellescape(toplevel:sub(0, -2)))
if vim.v.shell_error ~= 0 then
return nil
end