feat(#2799): filesystem_watchers.ignore_dirs and git.disable_for_dirs may be functions (#2800)

feat(#2799): filesystem_watchers.ignore_dirs and git.disable_for_dirs may be functions
This commit is contained in:
Alexander Courtis
2024-06-23 11:44:45 +10:00
committed by GitHub
parent 2086e564c4
commit 8b2c5c678b
4 changed files with 31 additions and 12 deletions

View File

@@ -170,12 +170,18 @@ function M.get_toplevel(path)
if not toplevel or not git_dir then
return nil
end
local toplevel_norm = vim.fn.fnamemodify(toplevel, ":p")
-- ignore disabled paths
for _, disabled_for_dir in ipairs(M.config.git.disable_for_dirs) do
local toplevel_norm = vim.fn.fnamemodify(toplevel, ":p")
local disabled_norm = vim.fn.fnamemodify(disabled_for_dir, ":p")
if toplevel_norm == disabled_norm then
if type(M.config.git.disable_for_dirs) == "table" then
for _, disabled_for_dir in ipairs(M.config.git.disable_for_dirs) do
local disabled_norm = vim.fn.fnamemodify(disabled_for_dir, ":p")
if toplevel_norm == disabled_norm then
return nil
end
end
elseif type(M.config.git.disable_for_dirs) == "function" then
if M.config.git.disable_for_dirs(toplevel_norm) then
return nil
end
end