folke / lazy.nvim

💤 A modern plugin manager for Neovim
https://lazy.folke.io/
Apache License 2.0
13.76k stars 328 forks source link

bug: plugin specs using the same base repo are not loaded properly #1619

Closed debugloop closed 1 month ago

debugloop commented 1 month ago

Did you check docs and existing issues?

Neovim version (nvim -v)

v0.10.0 Release Build

Operating system/version

NixOS unstable

Describe the bug

Since version 11.0.0 lazy does no longer work with specs using the same underlying directory/repo. See the repro for an example. The issue was introduced with the major version 11, version 10 still worked in its final minor versioning.

Steps To Reproduce

  1. run nvim -u repro.lua repro.lua as I provide it, and observe that only one of the mini.nvim modules is loaded in :Lazy
  2. switch the comment from line 12 to line 13 to use the version 10
  3. rm -r ./.repro
  4. repeat step 1, it's working now

Expected Behavior

Both specs should load correctly, even if they're based on the same plugin directory.

Repro

-- DO NOT change the paths and don't remove the colorscheme
local root = vim.fn.fnamemodify("./.repro", ":p")

-- set stdpaths to use .repro
for _, name in ipairs({ "config", "data", "state", "cache" }) do
    vim.env[("XDG_%s_HOME"):format(name:upper())] = root .. "/" .. name
end

-- bootstrap lazy
local lazypath = root .. "/plugins/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
    -- vim.fn.system({ "git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", lazypath })
    vim.fn.system({ "git", "clone", "--branch=v11.0.0", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", lazypath })
    -- vim.fn.system({ "git", "clone", "--branch=v10.24.3", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", lazypath })
end
vim.opt.runtimepath:prepend(lazypath)

-- install plugins
local plugins = {
    "folke/tokyonight.nvim",
    -- add any other plugins here
    {
        "echasnovski/mini.nvim",
        main = "mini.statusline",
        name = "mini.statusline",
        opts = {},
    },
    {
        "echasnovski/mini.nvim",
        main = "mini.tabline",
        name = "mini.tabline",
        opts = {},
    },
}
require("lazy").setup(plugins, {
    root = root .. "/plugins",
})

vim.cmd.colorscheme("tokyonight")
-- add anything else here
folke commented 1 month ago

Dup #1610

max397574 commented 1 month ago

duplicate of https://github.com/folke/lazy.nvim/issues/1610 tldr: it was an unintended bug which got fixed

debugloop commented 1 month ago

Sorry to bother you, search didn't turn that one up 🙃