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

set_handler triggered after plugin_type setup #992

Closed
EdenEast opened this issue Aug 2, 2022 · 1 comment
Closed

set_handler triggered after plugin_type setup #992

EdenEast opened this issue Aug 2, 2022 · 1 comment
Labels

Comments

@EdenEast
Copy link
Contributor

EdenEast commented Aug 2, 2022

  • nvim --version: v0.8.0-dev
  • git --version: 2.36.1
  • Operating system/version: linux
  • Terminal name/version: weztern

I am using set_handler to create a handler that will execute on every plugin regardless of key.

Example:

local data = {
  ["telescope.nvim"] = { commit = "6bddc38c25af7b50f99cb0c035248d7272971810", date = "2022-07-16T09:56:33+02:00"},
}
local packer = require('packer')
packer.set_handler(1, function(_, plugin, _)
  local name = plugin.short_name
  if data[name] then
    plugin.commit = data[name].commit
  end
end)
packer.init()
packer.use("nvim-telescope/telescope.nvim")

This handler does not take effect before the plugin type is setup. This means that the install_cmd does not see the commit update and sets --depth to 1 for the install command. When packer then goes to install it does see the commit change and tries to checkout the commit hash. Since the setup make the depth 1 that commit will not exist and fail to install.

There are two solutions I have thought of:

  1. Apply handlers before calling the plugin_type setup here
  2. set_handler(1, ...) might be the unintended. If so then create a similar construct for overall handler

Steps to reproduce

  1. Copy the example data and handler lines from example before your packer init/setup
  2. Delete your local telescope folder from your packer install location
  3. PackerInstall

Actual behaviour

Failed to install telescope at commit hash with a reference is not a tree.

Expected behaviour

Installed with correct commit hash

@EdenEast EdenEast added the bug label Aug 2, 2022
@EdenEast
Copy link
Contributor Author

EdenEast commented Aug 11, 2022

Closing as set_handler was not the solution to create a lockfile. Closing in favor of #1009

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant