perf(#3171): cache toplevel for untracked (#3185)

This commit is contained in:
Alexander Courtis 2025-08-12 10:34:24 +10:00 committed by GitHub
parent 000ca6bcdd
commit 442513648c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

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")