Skip to content

Commit

Permalink
fix(meta): only tag new top-level pkg fragment as optional
Browse files Browse the repository at this point in the history
  • Loading branch information
folke committed Jun 25, 2024
1 parent aff7ee8 commit 25981e1
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions lua/lazy/core/meta.lua
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,16 @@ function M:load_pkgs()
return
end
for _, pkg in ipairs(Pkg.get()) do
local last_id = self.fragments._fid
local meta, fragment = self:add(pkg.spec)
if meta and fragment then
meta._.pkg = pkg
-- tag all package fragments as optional
-- tag all top-level package fragments that were added as optional
for _, fid in ipairs(meta._.frags) do
local frag = self.fragments:get(fid)
frag.spec.optional = true
if fid > last_id then
local frag = self.fragments:get(fid)
frag.spec.optional = true
end
end
-- keep track of the top-level package fragment
self.pkgs[pkg.dir] = fragment.id
Expand Down

0 comments on commit 25981e1

Please sign in to comment.