chore: resolve undefined-field
This commit is contained in:
@@ -18,7 +18,7 @@ local DirectoryNode = require("nvim-tree.node.directory")
|
|||||||
|
|
||||||
---Git short-format statuses for a single node
|
---Git short-format statuses for a single node
|
||||||
---@class (exact) GitNodeStatus
|
---@class (exact) GitNodeStatus
|
||||||
---@field file GitXY
|
---@field file GitXY?
|
||||||
---@field dir table<"direct" | "indirect", GitXY[]>?
|
---@field dir table<"direct" | "indirect", GitXY[]>?
|
||||||
|
|
||||||
---Git state for an entire repo
|
---Git state for an entire repo
|
||||||
|
|||||||
@@ -138,12 +138,18 @@ end
|
|||||||
---@return GitNodeStatus
|
---@return GitNodeStatus
|
||||||
function M.git_status_file(parent_ignored, status, path, path_fallback)
|
function M.git_status_file(parent_ignored, status, path, path_fallback)
|
||||||
---@type GitNodeStatus
|
---@type GitNodeStatus
|
||||||
local ns = {}
|
local ns
|
||||||
|
|
||||||
if parent_ignored then
|
if parent_ignored then
|
||||||
ns.file = "!!"
|
ns = {
|
||||||
|
file = "!!"
|
||||||
|
}
|
||||||
elseif status and status.files then
|
elseif status and status.files then
|
||||||
ns.file = status.files[path] or status.files[path_fallback]
|
ns = {
|
||||||
|
file = status.files[path] or status.files[path_fallback]
|
||||||
|
}
|
||||||
|
else
|
||||||
|
ns = {}
|
||||||
end
|
end
|
||||||
|
|
||||||
return ns
|
return ns
|
||||||
@@ -160,16 +166,17 @@ function M.git_status_dir(parent_ignored, status, path, path_fallback)
|
|||||||
local ns
|
local ns
|
||||||
|
|
||||||
if parent_ignored then
|
if parent_ignored then
|
||||||
ns = {}
|
ns = {
|
||||||
ns.file = "!!"
|
file = "!!"
|
||||||
|
}
|
||||||
elseif status then
|
elseif status then
|
||||||
ns = {}
|
ns = {
|
||||||
ns.file = status.files and (status.files[path] or status.files[path_fallback])
|
file = status.files and (status.files[path] or status.files[path_fallback]),
|
||||||
if status.dirs then
|
dir = status.dirs and {
|
||||||
ns.dir = {}
|
direct = status.dirs.direct and status.dirs.direct[path],
|
||||||
ns.dir.direct = status.dirs.direct and status.dirs.direct[path]
|
indirect = status.dirs.indirect and status.dirs.indirect[path],
|
||||||
ns.dir.indirect = status.dirs.indirect and status.dirs.indirect[path]
|
},
|
||||||
end
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
return ns
|
return ns
|
||||||
|
|||||||
Reference in New Issue
Block a user