diff --git a/lua/nvim-tree/git/init.lua b/lua/nvim-tree/git/init.lua index 4c28e7c6..74d159b4 100644 --- a/lua/nvim-tree/git/init.lua +++ b/lua/nvim-tree/git/init.lua @@ -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 diff --git a/lua/nvim-tree/git/runner.lua b/lua/nvim-tree/git/runner.lua index 9cb13d1c..13b57383 100644 --- a/lua/nvim-tree/git/runner.lua +++ b/lua/nvim-tree/git/runner.lua @@ -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 = {