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:
@@ -4,6 +4,7 @@ local git_utils = require "nvim-tree.git.utils"
|
||||
local Runner = require "nvim-tree.git.runner"
|
||||
local Watcher = require("nvim-tree.watcher").Watcher
|
||||
local Iterator = require "nvim-tree.iterators.node-iterator"
|
||||
local explorer_node = require "nvim-tree.explorer.node"
|
||||
|
||||
local M = {
|
||||
config = {},
|
||||
@@ -103,19 +104,13 @@ local function reload_tree_at(project_root)
|
||||
end
|
||||
|
||||
M.reload_project(project_root)
|
||||
local project = M.get_project(project_root)
|
||||
|
||||
local project_files = project.files and project.files or {}
|
||||
local project_dirs = project.dirs and project.dirs or {}
|
||||
local git_status = M.get_project(project_root)
|
||||
|
||||
Iterator.builder(root_node.nodes)
|
||||
:hidden()
|
||||
:applier(function(node)
|
||||
local parent_ignored = node.parent.git_status == "!!"
|
||||
node.git_status = project_dirs[node.absolute_path] or project_files[node.absolute_path]
|
||||
if not node.git_status and parent_ignored then
|
||||
node.git_status = "!!"
|
||||
end
|
||||
local parent_ignored = explorer_node.is_git_ignored(node.parent)
|
||||
explorer_node.update_git_status(node, parent_ignored, git_status)
|
||||
end)
|
||||
:recursor(function(node)
|
||||
return node.nodes and #node.nodes > 0 and node.nodes
|
||||
|
||||
Reference in New Issue
Block a user