fix(git): git folder fixes and improvements (#1809)

* coding style

* outlined git.show_on_open_dirs behavior

* show some icon on opendir even if show_on_open_dir=false

and show all children's status on parent

* fixed renamed icon not showing

* sorted icons

* removed DU from deleted as file will show up in tree

* fixed update_git_status in reloaders not tested

* fixed Api.git.reload()

Tested update_git_status in reloaders.lua

* sort icon only if not git signcolumn

* fixed crashing when root dir isn't git dir

* made git.show_on_dirs doc more concise

* git_statuses -> git_status for consistency

* explorer/common.lua -> explorer/node.lua

* fixed #1784 conflict

* don't order icons

* Revert "don't order icons"

This reverts commit 23f6276ef7.
This commit is contained in:
Richard Li
2022-12-17 19:05:33 +13:00
committed by GitHub
parent 89c79cb33b
commit 29788cc32a
13 changed files with 263 additions and 189 deletions

View File

@@ -1,6 +1,6 @@
local git = require "nvim-tree.git"
local watch = require "nvim-tree.explorer.watch"
local common = require "nvim-tree.explorer.common"
local explorer_node = require "nvim-tree.explorer.node"
local M = {}
@@ -24,8 +24,8 @@ end
function Explorer:_load(node)
local cwd = node.link_to or node.absolute_path
local git_statuses = git.load_project_status(cwd)
M.explore(node, git_statuses)
local git_status = git.load_project_status(cwd)
M.explore(node, git_status)
end
function Explorer:expand(node)
@@ -34,7 +34,7 @@ end
function Explorer:destroy()
local function iterate(node)
common.node_destroy(node)
explorer_node.node_destroy(node)
if node.nodes then
for _, child in pairs(node.nodes) do
iterate(child)
@@ -45,7 +45,7 @@ function Explorer:destroy()
end
function M.setup(opts)
require("nvim-tree.explorer.common").setup(opts)
require("nvim-tree.explorer.node").setup(opts)
require("nvim-tree.explorer.explore").setup(opts)
require("nvim-tree.explorer.filters").setup(opts)
require("nvim-tree.explorer.sorters").setup(opts)