perf(#3171): cache toplevel for untracked

This commit is contained in:
Alexander Courtis 2025-08-11 15:33:34 +10:00
parent 000ca6bcdd
commit 0759a63ccf

View File

@ -193,9 +193,10 @@ function M.get_toplevel(path)
end end
end end
-- attempt to fetch toplevel -- attempt to fetch toplevel, cache if untracked
local toplevel, git_dir = git_utils.get_toplevel(path) local toplevel, git_dir = git_utils.get_toplevel(path)
if not toplevel or not git_dir then if not toplevel or not git_dir then
M._toplevels_by_path[path] = false
return nil return nil
end end
local toplevel_norm = vim.fn.fnamemodify(toplevel, ":p") local toplevel_norm = vim.fn.fnamemodify(toplevel, ":p")