Skip to content

Commit db8145c

Browse files
authored
fix(#2459): disable cygwin git support by default, see :help nvim-tree.git.cygwin_support to enable (#2486)
1 parent 8b4dbc5 commit db8145c

File tree

3 files changed

+17
-3
lines changed

3 files changed

+17
-3
lines changed

doc/nvim-tree-lua.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -473,6 +473,7 @@ Following is the default configuration. See |nvim-tree-opts| for details.
473473
show_on_open_dirs = true,
474474
disable_for_dirs = {},
475475
timeout = 400,
476+
cygwin_support = false,
476477
},
477478
diagnostics = {
478479
enable = false,
@@ -1118,6 +1119,10 @@ Kills the git process after some time if it takes too long.
11181119
Git integration will be disabled after 10 git jobs exceed this timeout.
11191120
Type: `number`, Default: `400` (ms)
11201121

1122+
*nvim-tree.git.cygwin_support*
1123+
Use `cygpath` if available to resolve paths for git.
1124+
Type: `boolean`, Default: `false`
1125+
11211126
==============================================================================
11221127
5.8 OPTS: DIAGNOSTICS *nvim-tree-opts-diagnostics*
11231128

lua/nvim-tree.lua

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -496,6 +496,7 @@ local DEFAULT_OPTS = { -- BEGIN_DEFAULT_OPTS
496496
show_on_open_dirs = true,
497497
disable_for_dirs = {},
498498
timeout = 400,
499+
cygwin_support = false,
499500
},
500501
diagnostics = {
501502
enable = false,
@@ -794,6 +795,7 @@ function M.setup(conf)
794795
require("nvim-tree.diagnostics").setup(opts)
795796
require("nvim-tree.explorer").setup(opts)
796797
require("nvim-tree.git").setup(opts)
798+
require("nvim-tree.git.utils").setup(opts)
797799
require("nvim-tree.view").setup(opts)
798800
require("nvim-tree.lib").setup(opts)
799801
require("nvim-tree.renderer").setup(opts)

lua/nvim-tree/git/utils.lua

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
local M = {}
21
local log = require "nvim-tree.log"
32
local utils = require "nvim-tree.utils"
43

5-
local has_cygpath = vim.fn.executable "cygpath" == 1
4+
local M = {
5+
use_cygpath = false,
6+
}
67

78
--- Retrieve the git toplevel directory
89
--- @param cwd string path
@@ -35,7 +36,7 @@ function M.get_toplevel(cwd)
3536
-- git always returns path with forward slashes
3637
if vim.fn.has "win32" == 1 then
3738
-- msys2 git support
38-
if has_cygpath then
39+
if M.use_cygpath then
3940
toplevel = vim.fn.system("cygpath -w " .. vim.fn.shellescape(toplevel))
4041
if vim.v.shell_error ~= 0 then
4142
return nil, nil
@@ -112,4 +113,10 @@ function M.file_status_to_dir_status(status, cwd)
112113
return r
113114
end
114115

116+
function M.setup(opts)
117+
if opts.git.cygwin_support then
118+
M.use_cygpath = vim.fn.executable "cygpath" == 1
119+
end
120+
end
121+
115122
return M

0 commit comments

Comments
 (0)