nvim: only list unique entries in mini.projects

This commit is contained in:
Daniel Lundin 2025-01-26 20:34:25 +01:00
parent 444539ac08
commit 666736f87f
Signed by: dln
SSH key fingerprint: SHA256:dQy1Xj3UiqJYpKR5ggQ2bxgz4jCH8IF+k3AB8o0kmdI

View file

@ -84,14 +84,18 @@ MiniPick.registry.projects = function(local_opts)
local postprocess = function(paths) local postprocess = function(paths)
local result = {} local result = {}
local seen = {}
for _, path in ipairs(paths) do for _, path in ipairs(paths) do
path = path:gsub("%/.jj/repo/store/type$", "") path = path:gsub("%/.jj/repo/store/type$", "")
path = path:gsub("%/.git/HEAD$", "") path = path:gsub("%/.git/HEAD$", "")
if not seen[path] then
local item = { local item = {
path = path, path = path,
text = path:gsub("%" .. root .. "/", ""), text = path:gsub("%" .. root .. "/", ""),
} }
table.insert(result, item) table.insert(result, item)
seen[path] = true
end
end end
return result return result
end end