* extract DirectoryLinkNode and FileLinkNode, move Node methods to children * temporarily move DirectoryNode methods into BaseNode for easier reviewing * move mostly unchanged DirectoryNode methods back to BaseNode * tidy * git.git_status_file takes an array * update git status of links * luacheck hack
This commit is contained in:
@@ -283,33 +283,46 @@ function M.load_project_status(path)
|
||||
end
|
||||
end
|
||||
|
||||
---Git file and directory status for an absolute path with optional file fallback
|
||||
---@param parent_ignored boolean
|
||||
---@param status table|nil
|
||||
---@param absolute_path string
|
||||
---@param path string
|
||||
---@param path_file string? alternative file path when no other file status
|
||||
---@return GitStatus|nil
|
||||
function M.git_status_dir(parent_ignored, status, absolute_path)
|
||||
function M.git_status_dir(parent_ignored, status, path, path_file)
|
||||
if parent_ignored then
|
||||
return { file = "!!" }
|
||||
end
|
||||
|
||||
if status then
|
||||
return {
|
||||
file = status.files and status.files[absolute_path],
|
||||
file = status.files and status.files[path] or path_file and status.files[path_file],
|
||||
dir = status.dirs and {
|
||||
direct = status.dirs.direct[absolute_path],
|
||||
indirect = status.dirs.indirect[absolute_path],
|
||||
direct = status.dirs.direct[path],
|
||||
indirect = status.dirs.indirect[path],
|
||||
},
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
---Git file status for an absolute path with optional fallback
|
||||
---@param parent_ignored boolean
|
||||
---@param status table|nil
|
||||
---@param absolute_path string
|
||||
---@param path string
|
||||
---@param path_fallback string?
|
||||
---@return GitStatus
|
||||
function M.git_status_file(parent_ignored, status, absolute_path)
|
||||
local file_status = parent_ignored and "!!" or (status and status.files and status.files[absolute_path])
|
||||
return { file = file_status }
|
||||
function M.git_status_file(parent_ignored, status, path, path_fallback)
|
||||
if parent_ignored then
|
||||
return { file = "!!" }
|
||||
end
|
||||
|
||||
if not status or not status.files then
|
||||
return {}
|
||||
end
|
||||
|
||||
return {
|
||||
file = status.files[path] or status.files[path_fallback]
|
||||
}
|
||||
end
|
||||
|
||||
function M.purge_state()
|
||||
|
||||
Reference in New Issue
Block a user