Skip to content

Commit 7672931

Browse files
committed
fix: remove git root lookup from git check ignored, may fix #236
1 parent e650b4a commit 7672931

File tree

1 file changed

+10
-17
lines changed

1 file changed

+10
-17
lines changed

lua/neo-tree/git/ignored.lua

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -48,36 +48,29 @@ local get_root_for_item = function(item)
4848
end
4949

5050
M.mark_ignored = function(state, items)
51-
local git_roots = {}
51+
local folders = {}
5252
log.trace("================================================================================")
5353
log.trace("IGNORED: mark_ignore BEGIN...")
5454
for _, item in ipairs(items) do
55-
local root = get_root_for_item(item)
56-
if root then
57-
if not git_roots[root] then
58-
git_roots[root] = {}
55+
local folder = utils.split_path(item.path)
56+
if folder then
57+
if not folders[folder] then
58+
folders[folder] = {}
5959
end
60-
table.insert(git_roots[root], item.path)
60+
table.insert(folders[folder], item.path)
6161
end
6262
end
6363

6464
local all_results = {}
65-
for repo_root, repo_items in pairs(git_roots) do
66-
local cmd = {"git", "-C", repo_root, "check-ignore"}
67-
for _, item in ipairs(repo_items) do
65+
for folder, folder_items in pairs(folders) do
66+
local cmd = {"git", "-C", folder, "check-ignore"}
67+
for _, item in ipairs(folder_items) do
6868
table.insert(cmd, item)
6969
end
7070
log.trace("IGNORED: Running cmd: ", cmd)
7171
local result = vim.fn.systemlist(cmd)
7272
if vim.v.shell_error == 128 then
73-
if type(result) == "table" then
74-
if vim.startswith(result[1], "fatal:") then
75-
-- These errors are all about not being in a repository
76-
log.error("Error in git.mark_ignored: ", result[1])
77-
result = {}
78-
end
79-
end
80-
log.error("Failed to load ignored files for", state.path, ":", result)
73+
log.debug("Failed to load ignored files for", state.path, ":", result)
8174
result = {}
8275
end
8376

0 commit comments

Comments
 (0)