Revert "chore: resolve undefined-field"

This reverts commit e82db1c44d.
This commit is contained in:
Alexander Courtis
2024-10-27 15:18:05 +11:00
parent e82db1c44d
commit a16e67f3f4
5 changed files with 62 additions and 46 deletions

View File

@@ -127,6 +127,51 @@ function M.file_status_to_dir_status(status, cwd)
return r
end
---Git file status for an absolute path with optional fallback
---@param parent_ignored boolean
---@param status table?
---@param path string
---@param path_fallback string?
---@return GitStatus
function M.git_status_file(parent_ignored, status, path, path_fallback)
---@type GitStatus
local st = {}
if parent_ignored then
st.file = "!!"
elseif status and status.files then
st.file = status.files[path] or status.files[path_fallback]
end
return st
end
---Git file and directory status for an absolute path with optional file fallback
---@param parent_ignored boolean
---@param status table?
---@param path string
---@param path_file string? alternative file path when no other file status
---@return GitStatus?
function M.git_status_dir(parent_ignored, status, path, path_file)
---@type GitStatus?
local st
if parent_ignored then
st = {}
st.file = "!!"
elseif status then
st = {}
st.file = status.files and (status.files[path] or status.files[path_file])
if status.dirs then
st.dir = {}
st.dir.direct = status.dirs.direct and status.dirs.direct[path]
st.dir.indirect = status.dirs.indirect and status.dirs.indirect[path]
end
end
return st
end
function M.setup(opts)
if opts.git.cygwin_support then
M.use_cygpath = vim.fn.executable("cygpath") == 1