chore: resolve undefined-field

This commit is contained in:
Alexander Courtis
2024-10-28 15:15:23 +11:00
parent 4372e6a217
commit a4a6e6caa3
2 changed files with 10 additions and 8 deletions

View File

@@ -82,8 +82,8 @@ local function path_ignored_in_project(path, project)
end
if project.files then
for file, status in pairs(project.files) do
if status == "!!" and vim.startswith(path, file) then
for p, xy in pairs(project.files) do
if xy == "!!" and vim.startswith(path, p) then
return true
end
end
@@ -235,13 +235,13 @@ local function reload_tree_at(toplevel)
end
M.reload_project(toplevel, nil, function()
local git_status = M.get_project(toplevel)
local project = M.get_project(toplevel)
Iterator.builder(root_node.nodes)
:hidden()
:applier(function(node)
local parent_ignored = node.parent and node.parent:is_git_ignored() or false
node:update_git_status(parent_ignored, git_status)
node:update_git_status(parent_ignored, project)
end)
:recursor(function(node)
return node.nodes and #node.nodes > 0 and node.nodes
@@ -371,9 +371,9 @@ function M.reload_node_status(dir, projects)
end
local toplevel = M.get_toplevel(dir.absolute_path)
local status = projects[toplevel] or {}
local project = projects[toplevel] or {}
for _, node in ipairs(dir.nodes) do
node:update_git_status(dir:is_git_ignored(), status)
node:update_git_status(dir:is_git_ignored(), project)
M.reload_node_status(node:as(DirectoryNode), projects)
end
end

View File

@@ -205,8 +205,9 @@ function GitRunner:finalise()
end
end
---Return nil when callback present
---@private
---@return GitPathXY? statuses nil if callback present
---@return GitPathXY?
function GitRunner:execute()
local async = self.opts.callback ~= nil
local profile = log.profile_start("git %s job %s %s", async and "async" or "sync", self.opts.toplevel, self.opts.path)
@@ -238,8 +239,9 @@ function GitRunner:execute()
end
---Static method to run a git process, which will be killed if it takes more than timeout
---Return nil when callback present
---@param opts GitRunnerOpts
---@return GitPathXY? statuses nil if callback present
---@return GitPathXY?
function GitRunner:run(opts)
---@type GitRunner
local runner = {