Skip to content

Commit 6abc87b

Browse files
authored
feat: msys2 git support (#1295)
1 parent 540c811 commit 6abc87b

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

lua/nvim-tree/git/utils.lua

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
local M = {}
22

3+
local has_cygpath = vim.fn.executable "cygpath" == 1
4+
35
function M.get_toplevel(cwd)
46
local cmd = "git -C " .. vim.fn.shellescape(cwd) .. " rev-parse --show-toplevel"
57
local toplevel = vim.fn.system(cmd)
@@ -10,6 +12,10 @@ function M.get_toplevel(cwd)
1012

1113
-- git always returns path with forward slashes
1214
if vim.fn.has "win32" == 1 then
15+
-- msys2 git support
16+
if has_cygpath then
17+
toplevel = vim.fn.system("cygpath -w " .. vim.fn.shellescape(toplevel))
18+
end
1319
toplevel = toplevel:gsub("/", "\\")
1420
end
1521

0 commit comments

Comments
 (0)