From 64aacb67ab8e4b76ab32ab316c43df5a94fbf0b3 Mon Sep 17 00:00:00 2001 From: Andrew Wong Date: Sat, 10 Jul 2021 18:05:53 +1000 Subject: [PATCH] fix: don't populate git status when git unused (#499) --- lua/nvim-tree/lib.lua | 8 ++++++-- lua/nvim-tree/populate.lua | 4 +++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/lua/nvim-tree/lib.lua b/lua/nvim-tree/lib.lua index c0681253..82e63d20 100644 --- a/lua/nvim-tree/lib.lua +++ b/lua/nvim-tree/lib.lua @@ -28,7 +28,9 @@ function M.init(with_open, with_reload) if not M.Tree.cwd then M.Tree.cwd = luv.cwd() 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) local stat = luv.fs_stat(M.Tree.cwd) @@ -130,7 +132,9 @@ function M.unroll_dir(node) if #node.entries > 0 then renderer.draw(M.Tree, true) 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) renderer.draw(M.Tree, true) diff --git a/lua/nvim-tree/populate.lua b/lua/nvim-tree/populate.lua index a7b37631..21f96e9f 100644 --- a/lua/nvim-tree/populate.lua +++ b/lua/nvim-tree/populate.lua @@ -354,7 +354,9 @@ function M.populate(entries, cwd, parent_node) return 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 return M