* stylua -> EmmyLuaCodeStyle: config and doc * stylua -> EmmyLuaCodeStyle: CI * stylua -> EmmyLuaCodeStyle: CI * stylua -> EmmyLuaCodeStyle: CI * stylua -> EmmyLuaCodeStyle: CI * stylua -> EmmyLuaCodeStyle: CI * stylua -> EmmyLuaCodeStyle * stylua -> EmmyLuaCodeStyle: call_arg_parentheses = always * stylua -> EmmyLuaCodeStyle * stylua -> EmmyLuaCodeStyle
This commit is contained in:
committed by
GitHub
parent
9650e735ba
commit
1ae1c33ce1
@@ -1,5 +1,5 @@
|
||||
local log = require "nvim-tree.log"
|
||||
local utils = require "nvim-tree.utils"
|
||||
local log = require("nvim-tree.log")
|
||||
local utils = require("nvim-tree.utils")
|
||||
|
||||
local M = {
|
||||
use_cygpath = false,
|
||||
@@ -21,30 +21,30 @@ function M.get_toplevel(cwd)
|
||||
log.raw("git", out)
|
||||
log.profile_end(profile)
|
||||
|
||||
if vim.v.shell_error ~= 0 or not out or #out == 0 or out:match "fatal" then
|
||||
if vim.v.shell_error ~= 0 or not out or #out == 0 or out:match("fatal") then
|
||||
return nil, nil
|
||||
end
|
||||
|
||||
local toplevel, git_dir = out:match "([^\n]+)\n+([^\n]+)"
|
||||
local toplevel, git_dir = out:match("([^\n]+)\n+([^\n]+)")
|
||||
if not toplevel then
|
||||
return nil, nil
|
||||
end
|
||||
if not git_dir then
|
||||
git_dir = utils.path_join { toplevel, ".git" }
|
||||
git_dir = utils.path_join({ toplevel, ".git" })
|
||||
end
|
||||
|
||||
-- git always returns path with forward slashes
|
||||
if vim.fn.has "win32" == 1 then
|
||||
if vim.fn.has("win32") == 1 then
|
||||
-- msys2 git support
|
||||
-- cygpath calls must in array format to avoid shell compatibility issues
|
||||
if M.use_cygpath then
|
||||
toplevel = vim.fn.system { "cygpath", "-w", toplevel }
|
||||
toplevel = vim.fn.system({ "cygpath", "-w", toplevel })
|
||||
if vim.v.shell_error ~= 0 then
|
||||
return nil, nil
|
||||
end
|
||||
-- remove trailing newline(\n) character added by vim.fn.system
|
||||
toplevel = toplevel:gsub("\n", "")
|
||||
git_dir = vim.fn.system { "cygpath", "-w", git_dir }
|
||||
git_dir = vim.fn.system({ "cygpath", "-w", git_dir })
|
||||
if vim.v.shell_error ~= 0 then
|
||||
return nil, nil
|
||||
end
|
||||
@@ -128,7 +128,7 @@ end
|
||||
|
||||
function M.setup(opts)
|
||||
if opts.git.cygwin_support then
|
||||
M.use_cygpath = vim.fn.executable "cygpath" == 1
|
||||
M.use_cygpath = vim.fn.executable("cygpath") == 1
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user