Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

msys2 git support #1290

Closed
bstaint opened this issue May 24, 2022 · 2 comments · Fixed by #1295
Closed

msys2 git support #1290

bstaint opened this issue May 24, 2022 · 2 comments · Fixed by #1295
Labels
feature request PR please nvim-tree team does not have the bandwidth to implement; a PR will be gratefully appreciated

Comments

@bstaint
Copy link
Contributor

bstaint commented May 24, 2022

Is your feature request related to a problem? Please describe.
msys2 git support

Describe the solution you'd like
msys git path like /e/Downloads/testc(E:\Downloads\testc)

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context
patch:

diff --git a/lua/nvim-tree/git/utils.lua b/lua/nvim-tree/git/utils.lua
index 21f2c7f..cb28f8d 100644
--- a/lua/nvim-tree/git/utils.lua
+++ b/lua/nvim-tree/git/utils.lua
@@ -10,6 +10,10 @@ function M.get_toplevel(cwd)
 
   -- git always returns path with forward slashes
   if vim.fn.has "win32" == 1 then
+    -- msys2
+    if vim.fn.executable('cygpath') then
+        toplevel = vim.fn.system("cygpath -w " .. vim.fn.shellescape(toplevel))
+    end
     toplevel = toplevel:gsub("/", "\\")
   end
@alex-courtis alex-courtis added the PR please nvim-tree team does not have the bandwidth to implement; a PR will be gratefully appreciated label May 25, 2022
@alex-courtis
Copy link
Member

I have no way to verify this; I don't know what msys2 is and I don't have a windows environment to validate with.

@kyazdani42 I'm happy to just accept this, as it is an unreachable code path for most cases.

@kyazdani42
Copy link
Member

Something like this would be good yes, but just doing the cygpath check globally instead of each time running the get_toplevel function. I have no idea what msys2 is and i don't have a windows environment either.
@bstaint please just make a PR if you need this :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request PR please nvim-tree team does not have the bandwidth to implement; a PR will be gratefully appreciated
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants