Skip to content

Commit 6364fa1

Browse files
committed
update
1 parent 84d7163 commit 6364fa1

File tree

3 files changed

+11
-19
lines changed

3 files changed

+11
-19
lines changed

lua/neo-tree/git/init.lua

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -352,25 +352,16 @@ end
352352
---@param state neotree.State
353353
---@param items neotree.FileItem[]
354354
M.mark_ignored = function(state, items)
355+
local gs = state.git_status_lookup
356+
if not gs then
357+
return
358+
end
355359
for _, i in ipairs(items) do
356-
repeat
357-
local path = i.path
358-
local git_root = M.get_repository_root(path)
359-
if not git_root then
360-
break
361-
end
362-
local status = M.status_cache[git_root] or M.status("HEAD", false, path)
363-
if not status then
364-
break
365-
end
366-
367-
local direct_lookup = M.status_cache[git_root][path]
368-
or M.status_cache[git_root][path .. utils.path_separator]
369-
if direct_lookup then
370-
i.filtered_by = i.filtered_by or {}
371-
i.filtered_by.gitignored = true
372-
end
373-
until true
360+
local direct_lookup = gs[i.path] or gs[i.path .. utils.path_separator]
361+
if direct_lookup == "!" then
362+
i.filtered_by = i.filtered_by or {}
363+
i.filtered_by.gitignored = true
364+
end
374365
end
375366
end
376367

lua/neo-tree/sources/filesystem/lib/fs_scan.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ local job_complete = function(context)
119119
local state = context.state
120120
file_nesting.nest_items(context)
121121
ignored.mark_ignored(state, context.all_items)
122+
git.mark_ignored(state, context.all_items)
122123
render_context(context)
123124
return context
124125
end

lua/neo-tree/utils/init.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -839,7 +839,7 @@ M.open_file = function(state, path, open_cmd, bufnr)
839839
result, err = M.force_new_split(state.current_position, escaped_path)
840840
end
841841
end
842-
if result or err == "Vim(edit):E325: ATTENTION" then
842+
if result or err:find("Vim(edit):E325: ATTENTION") then
843843
-- fixes #321
844844
vim.bo[0].buflisted = true
845845
events.fire_event(events.FILE_OPENED, path)

0 commit comments

Comments
 (0)