fix(#2459): disable cygwin git support by default, see :help nvim-tree.git.cygwin_support to enable (#2486)

This commit is contained in:
Alexander Courtis 2023-10-21 16:34:34 +11:00 committed by GitHub
parent 8b4dbc57e4
commit db8145c27d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 3 deletions

View File

@ -473,6 +473,7 @@ Following is the default configuration. See |nvim-tree-opts| for details.
show_on_open_dirs = true,
disable_for_dirs = {},
timeout = 400,
cygwin_support = false,
},
diagnostics = {
enable = false,
@ -1118,6 +1119,10 @@ Kills the git process after some time if it takes too long.
Git integration will be disabled after 10 git jobs exceed this timeout.
Type: `number`, Default: `400` (ms)
*nvim-tree.git.cygwin_support*
Use `cygpath` if available to resolve paths for git.
Type: `boolean`, Default: `false`
==============================================================================
5.8 OPTS: DIAGNOSTICS *nvim-tree-opts-diagnostics*

View File

@ -496,6 +496,7 @@ local DEFAULT_OPTS = { -- BEGIN_DEFAULT_OPTS
show_on_open_dirs = true,
disable_for_dirs = {},
timeout = 400,
cygwin_support = false,
},
diagnostics = {
enable = false,
@ -794,6 +795,7 @@ function M.setup(conf)
require("nvim-tree.diagnostics").setup(opts)
require("nvim-tree.explorer").setup(opts)
require("nvim-tree.git").setup(opts)
require("nvim-tree.git.utils").setup(opts)
require("nvim-tree.view").setup(opts)
require("nvim-tree.lib").setup(opts)
require("nvim-tree.renderer").setup(opts)

View File

@ -1,8 +1,9 @@
local M = {}
local log = require "nvim-tree.log"
local utils = require "nvim-tree.utils"
local has_cygpath = vim.fn.executable "cygpath" == 1
local M = {
use_cygpath = false,
}
--- Retrieve the git toplevel directory
--- @param cwd string path
@ -35,7 +36,7 @@ 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
if M.use_cygpath then
toplevel = vim.fn.system("cygpath -w " .. vim.fn.shellescape(toplevel))
if vim.v.shell_error ~= 0 then
return nil, nil
@ -112,4 +113,10 @@ function M.file_status_to_dir_status(status, cwd)
return r
end
function M.setup(opts)
if opts.git.cygwin_support then
M.use_cygpath = vim.fn.executable "cygpath" == 1
end
end
return M