Revert "fix(#1976): support non-standard $GIT_DIR (#2012)"

This reverts commit 517dee64c1.
This commit is contained in:
Alexander Courtis
2023-04-29 16:42:51 +10:00
parent bb375fb203
commit 1f5bbc1efd
4 changed files with 38 additions and 82 deletions

View File

@@ -5,11 +5,10 @@ local M = {
debouncers = {},
}
local has_cygpath = vim.fn.executable "cygpath" == 1
M.is_unix = vim.fn.has "unix" == 1
M.is_macos = vim.fn.has "mac" == 1 or vim.fn.has "macunix" == 1
M.is_wsl = vim.fn.has "wsl" == 1
-- false for WSL
M.is_windows = vim.fn.has "win32" == 1 or vim.fn.has "win32unix" == 1
function M.str_find(haystack, needle)
@@ -39,26 +38,6 @@ function M.path_split(path)
return path:gmatch("[^" .. path_separator .. "]+" .. path_separator .. "?")
end
--- Normalise a path:
--- windows: replace slashes with backslashes
--- cygwin: resolve path first via cygpath
--- @param path string
--- @return string|nil nil on cygpath failure
function M.norm_path(path)
if M.is_windows then
-- msys2 git support
if has_cygpath then
path = vim.fn.system("cygpath -w " .. vim.fn.shellescape(path))
if vim.v.shell_error ~= 0 then
return nil
end
end
path = path:gsub("/", "\\")
end
return path
end
---Get the basename of the given path.
---@param path string
---@return string