Merge pull request #77 from kristijanhusak/feature/folder-git-status

Inherit git status from nested files on directory.
This commit is contained in:
Kiyan Yazdani 2020-08-03 16:11:36 +02:00 committed by GitHub
commit 1aee593b5d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 3 deletions

View File

@ -6,7 +6,7 @@ local roots = {}
local not_git = 'not a git repo' local not_git = 'not a git repo'
local function update_root_status(root) local function update_root_status(root)
local status = vim.fn.systemlist('cd '..root..' && git status --porcelain=v1') local status = vim.fn.systemlist('cd '..root..' && git status --porcelain=v1 -u')
roots[root] = {} roots[root] = {}
for _, v in pairs(status) do for _, v in pairs(status) do
@ -76,9 +76,9 @@ function M.update_status(entries, _cwd)
node.git_status = status node.git_status = status
elseif node.entries ~= nil then elseif node.entries ~= nil then
local matcher = '^'..utils.path_to_matching_str(relpath) local matcher = '^'..utils.path_to_matching_str(relpath)
for key, _ in pairs(git_status) do for key, entry_status in pairs(git_status) do
if key:match(matcher) then if key:match(matcher) then
node.git_status = 'dirty' node.git_status = entry_status
break break
end end
end end

View File

@ -16,6 +16,7 @@ augroup LuaTree
endif endif
au VimEnter * lua require'tree'.on_enter() au VimEnter * lua require'tree'.on_enter()
au ColorScheme * lua require'tree'.reset_highlight() au ColorScheme * lua require'tree'.reset_highlight()
au User FugitiveChanged lua require'tree'.refresh()
augroup end augroup end
command! LuaTreeOpen lua require'tree'.open() command! LuaTreeOpen lua require'tree'.open()