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:
@@ -2,7 +2,7 @@ local utils = require "nvim-tree.utils"
|
||||
local view = require "nvim-tree.view"
|
||||
local core = require "nvim-tree.core"
|
||||
local lib = require "nvim-tree.lib"
|
||||
local explorer_common = require "nvim-tree.explorer.common"
|
||||
local explorer_node = require "nvim-tree.explorer.node"
|
||||
|
||||
local M = {}
|
||||
|
||||
@@ -15,7 +15,7 @@ function M.fn(where, what)
|
||||
for line, node in pairs(nodes_by_line) do
|
||||
local valid = false
|
||||
if what == "git" then
|
||||
valid = explorer_common.shows_git_status(node)
|
||||
valid = explorer_node.get_git_status(node) ~= nil
|
||||
elseif what == "diag" then
|
||||
valid = node.diag_status ~= nil
|
||||
end
|
||||
|
||||
@@ -3,6 +3,7 @@ local view = require "nvim-tree.view"
|
||||
local renderer = require "nvim-tree.renderer"
|
||||
local explorer_module = require "nvim-tree.explorer"
|
||||
local core = require "nvim-tree.core"
|
||||
local explorer_node = require "nvim-tree.explorer.node"
|
||||
|
||||
local M = {}
|
||||
|
||||
@@ -21,11 +22,7 @@ function M.reload_node_status(parent_node, projects)
|
||||
local project_root = git.get_project_root(parent_node.absolute_path)
|
||||
local status = projects[project_root] or {}
|
||||
for _, node in ipairs(parent_node.nodes) do
|
||||
if node.nodes then
|
||||
node.git_status = status.dirs and status.dirs[node.absolute_path]
|
||||
else
|
||||
node.git_status = status.files and status.files[node.absolute_path]
|
||||
end
|
||||
explorer_node.update_git_status(node, explorer_node.is_git_ignored(parent_node), status)
|
||||
if node.nodes and #node.nodes > 0 then
|
||||
M.reload_node_status(node, projects)
|
||||
end
|
||||
@@ -50,7 +47,7 @@ function M.reload_explorer(_, unloaded_bufnr)
|
||||
end
|
||||
|
||||
function M.reload_git()
|
||||
if not core.get_explorer() or not git.config.enable or event_running then
|
||||
if not core.get_explorer() or not git.config.git.enable or event_running then
|
||||
return
|
||||
end
|
||||
event_running = true
|
||||
|
||||
Reference in New Issue
Block a user