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: Changing branch after current one is deleted reports an error #1052

Closed
3 tasks done
kristijanhusak opened this issue Sep 28, 2023 · 2 comments
Closed
3 tasks done
Labels
bug Something isn't working

Comments

@kristijanhusak
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)

NVIM v0.10.0-dev-1913041

Operating system/version

Linux

Describe the bug

I was using v3 branch of https://github.com/lukas-reineke/indent-blankline.nvim until Lukas released it officially. Today I wanted to go back to master branch, but I wasn't able to do that because he deleted the v3 branch, and Lazy now stucks on attempting to fetch some information about deleted branch.

Here's a screenshot:
screenshot

And my config for the plugin:

return {
  'lukas-reineke/indent-blankline.nvim',
  -- behaves same with and without a branch
  -- branch = 'master',
  event = 'VeryLazy',
  config = function()
    require('ibl').setup()
  end,
}

Git status in the plugin directory:
git-status

Steps To Reproduce

Since this one requires remote changes to a plugin to be tested, I'll write steps as you would do it with some of your plugins:

  1. Create a branch test-branch on https://github.com/folke/tokyonight.nvim, push it to remote
  2. Update your local config to point to that branch, run Lazy sync
  3. Go to github and delete the branch
  4. Remove branch option from your init.lua configuration or set it to some other existing branch like main
  5. Do Lazy sync
  6. You get an error fatal: couldn't find remote ref refs/heads/test-branch

Expected Behavior

I would expect just to switch to a new branch.

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

-- install plugins
local plugins = {
  {
    "folke/tokyonight.nvim",
    branch = "test-branch"
  },
   
}
require("lazy").setup(plugins, {
  root = root .. "/plugins",
})

vim.cmd.colorscheme("tokyonight")
-- add anything else here
@kristijanhusak kristijanhusak added the bug Something isn't working label Sep 28, 2023
@folke
Copy link
Owner

folke commented Sep 28, 2023

Press x on the plugin and then i

@folke folke closed this as not planned Won't fix, can't repro, duplicate, stale Sep 28, 2023
@kristijanhusak
Copy link
Author

Yeah, I forgot to mention the workaround. I just thought it was something that should happen automatically.

Thanks!

mikavilpas added a commit to mikavilpas/yazi.nvim that referenced this issue Jul 15, 2024
This seems to be the same issue, and provides a workaround for it:

folke/lazy.nvim#1052 (comment)

I added a notice about this to the README.md file.
mikavilpas added a commit to mikavilpas/yazi.nvim that referenced this issue Jul 15, 2024
This seems to be the same issue, and provides a workaround for it:

folke/lazy.nvim#1052 (comment)

I added a notice about this to the README.md file.
mikavilpas added a commit to mikavilpas/yazi.nvim that referenced this issue Jul 15, 2024
This seems to be the same issue, and provides a workaround for it:

folke/lazy.nvim#1052 (comment)

I added a notice about this to the README.md file.
mikavilpas added a commit to mikavilpas/yazi.nvim that referenced this issue Jul 15, 2024
This seems to be the same issue, and provides a workaround for it:

folke/lazy.nvim#1052 (comment)

I added a notice about this to the README.md file.
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