fix: don't populate git status when git unused (#499)

This commit is contained in:
Andrew Wong
2021-07-10 18:05:53 +10:00
committed by GitHub
parent 933d69a37f
commit 64aacb67ab
2 changed files with 9 additions and 3 deletions

View File

@@ -28,7 +28,9 @@ function M.init(with_open, with_reload)
if not M.Tree.cwd then if not M.Tree.cwd then
M.Tree.cwd = luv.cwd() M.Tree.cwd = luv.cwd()
end end
git.git_root(M.Tree.cwd) if config.use_git() then
git.git_root(M.Tree.cwd)
end
populate(M.Tree.entries, M.Tree.cwd) populate(M.Tree.entries, M.Tree.cwd)
local stat = luv.fs_stat(M.Tree.cwd) local stat = luv.fs_stat(M.Tree.cwd)
@@ -130,7 +132,9 @@ function M.unroll_dir(node)
if #node.entries > 0 then if #node.entries > 0 then
renderer.draw(M.Tree, true) renderer.draw(M.Tree, true)
else else
git.git_root(node.absolute_path) if config.use_git() then
git.git_root(node.absolute_path)
end
populate(node.entries, node.link_to or node.absolute_path, node) populate(node.entries, node.link_to or node.absolute_path, node)
renderer.draw(M.Tree, true) renderer.draw(M.Tree, true)

View File

@@ -354,7 +354,9 @@ function M.populate(entries, cwd, parent_node)
return return
end end
vim.schedule(function() git.update_status(entries, cwd, parent_node) end) if config.use_git() then
vim.schedule(function() git.update_status(entries, cwd, parent_node) end)
end
end end
return M return M