From 202b0da71b5282cbc1bd944ca00808d1995e1c12 Mon Sep 17 00:00:00 2001 From: bstaint Date: Thu, 26 May 2022 20:49:18 +0800 Subject: [PATCH 1/2] feat: msys2 git support --- lua/nvim-tree/git/utils.lua | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lua/nvim-tree/git/utils.lua b/lua/nvim-tree/git/utils.lua index 21f2c7f2a3a..a59cf0e2e77 100644 --- a/lua/nvim-tree/git/utils.lua +++ b/lua/nvim-tree/git/utils.lua @@ -1,5 +1,7 @@ local M = {} +local has_cygpath = vim.fn.executable('cygpath') == 1 + function M.get_toplevel(cwd) local cmd = "git -C " .. vim.fn.shellescape(cwd) .. " rev-parse --show-toplevel" local toplevel = vim.fn.system(cmd) @@ -10,6 +12,10 @@ function M.get_toplevel(cwd) -- git always returns path with forward slashes if vim.fn.has "win32" == 1 then + -- msys2 git support + if has_cygpath then + toplevel = vim.fn.system("cygpath -w " .. vim.fn.shellescape(toplevel)) + end toplevel = toplevel:gsub("/", "\\") end From 8d374ef24b1073781c66a941ef9c7d94ca290cf4 Mon Sep 17 00:00:00 2001 From: bstaint Date: Thu, 26 May 2022 21:18:06 +0800 Subject: [PATCH 2/2] fix stylua check --- lua/nvim-tree/git/utils.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lua/nvim-tree/git/utils.lua b/lua/nvim-tree/git/utils.lua index a59cf0e2e77..0ff8327bf99 100644 --- a/lua/nvim-tree/git/utils.lua +++ b/lua/nvim-tree/git/utils.lua @@ -1,6 +1,6 @@ local M = {} -local has_cygpath = vim.fn.executable('cygpath') == 1 +local has_cygpath = vim.fn.executable "cygpath" == 1 function M.get_toplevel(cwd) local cmd = "git -C " .. vim.fn.shellescape(cwd) .. " rev-parse --show-toplevel" @@ -14,7 +14,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)) end toplevel = toplevel:gsub("/", "\\") end