Skip to content

Commit 60c2fb6

Browse files
committed
fix: ignore git errors when checking ignored oustide of a repo
1 parent 576fb44 commit 60c2fb6

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

lua/neo-tree/git/ignored.lua

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,13 @@ M.load_ignored_per_directory = function(path)
1414
local cmd = string.format("git -C %s check-ignore %s%s*", esc_path, esc_path, sep)
1515
local result = vim.fn.systemlist(cmd)
1616
if vim.v.shell_error == 128 then
17-
if utils.truthy(result) and vim.startswith(result[1], "fatal: not a git repository") then
18-
return {}
17+
if type(result) == "table" then
18+
if result[1] == "fatal: this operation must be run in a work tree" then
19+
return {}
20+
end
21+
if vim.startswith(result[1], "fatal: not a git repository") then
22+
return {}
23+
end
1924
end
2025
log.error("Failed to load ignored files for ", path, ": ", result)
2126
return {}

0 commit comments

Comments
 (0)