* add todo * refactor(#2886): multi instance: node class refactoring: extract links, *_git_status (#2944) * 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 * safer git_status_dir * refactor(#2886): multi instance: node class refactoring: DirectoryNode:expand_or_collapse (#2957) move expand_or_collapse to DirectoryNode * refactor(#2886): multi instance: node group functions refactoring (#2959) * move last_group_node to DirectoryNode * move add BaseNode:as and more doc * revert parameter name changes * revert parameter name changes * add Class * move group methods into DN * tidy group methods * tidy group methods * tidy group methods * tidy group methods * parent is DirectoryNode * tidy expand all * BaseNode -> Node * move watcher to DirectoryNode * last_group_node is DirectoryNode only * simplify create-file * simplify parent * simplify collapse-all * simplify live-filter * style * more type safety
This commit is contained in:
committed by
GitHub
parent
63c7ad9037
commit
68be6df2fc
@@ -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 status.files[path_file]),
|
||||
dir = status.dirs and {
|
||||
direct = status.dirs.direct[absolute_path],
|
||||
indirect = status.dirs.indirect[absolute_path],
|
||||
direct = status.dirs.direct and status.dirs.direct[path],
|
||||
indirect = status.dirs.indirect and 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