Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: Duplicate fetch = +refs/heads/main:refs/remotes/origin/main is added to lazy.nvim/.git/config every time :Lazy update/sync runs if lazy.nvim is cloned with --branch=stable #1549

Closed
3 tasks done
Frederick888 opened this issue Jun 25, 2024 · 4 comments
Labels
bug Something isn't working

Comments

@Frederick888
Copy link

Did you check docs and existing issues?

  • I have read all the lazy.nvim docs
  • I have searched the existing issues of lazy.nvim
  • I have searched the existing issues of plugins related to this issue

Neovim version (nvim -v)

v0.10.0

Operating system/version

Arch Linux (rolling)

Describe the bug

If lazy.nvim is cloned with --branch, every time I run :Lazy update/sync, a fetch = +refs/heads/main:refs/remotes/origin/main is added to lazy.nvim/.git/config's [remote "origin"] section.

Steps To Reproduce

  1. nvim -u repro.lua repro.lua
  2. :Lazy update a few times
  3. cat .repro/plugins/lazy.nvim/.git/config

Expected Behavior

I understand it's harmless, but still it'd be nice to avoid this.

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", "--branch=stable", lazypath, })
end
vim.opt.runtimepath:prepend(lazypath)

-- install plugins
local plugins = {
  "folke/tokyonight.nvim",
  -- add any other plugins here
}
require("lazy").setup(plugins, {
  root = root .. "/plugins",
})

vim.cmd.colorscheme("tokyonight")
-- add anything else here
@Frederick888 Frederick888 added the bug Something isn't working label Jun 25, 2024
@folke
Copy link
Owner

folke commented Jun 25, 2024

This seems like a git bug tbh. Lazy doesn't change that file.

@folke folke closed this as not planned Won't fix, can't repro, duplicate, stale Jun 25, 2024
@Frederick888
Copy link
Author

Frederick888 commented Jun 25, 2024

Thanks for the quick response! I'm AFK right now and I'll have a closer look later. But I'm guessing that this is caused by the git remote set-branches call at

? If this is true, since it uses --add, arguably git is just doing what it's asked to do?

I'm not sure how M.branch is used, but maybe we can skip it if git config --get-all remote.origin.fetch already contains the branch?

@folke folke reopened this Jun 25, 2024
@folke
Copy link
Owner

folke commented Jun 25, 2024

That's needed when a plugin's branch changes in its spec.
But yes, that's definitely it!

@folke
Copy link
Owner

folke commented Jun 26, 2024

Fixed!

@folke folke closed this as completed Jun 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants