Merge pull request #77 from kristijanhusak/feature/folder-git-status
Inherit git status from nested files on directory.
This commit is contained in:
commit
1aee593b5d
@ -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
|
||||||
|
|||||||
@ -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()
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user