fix(pack): more advice for out-of-sync lockfile #38931

Problem: If the lockfile points to the revision that is not on disk, the
  `:checkhealth vim.pack` suggests to run `vim.pack.update()`. Although
  usually it should resolve the problem, it is not always the case: like
  if the state on disk is already the latest available.

Solution: Add an extra suggestion with a more drastic measure by
  manually removing `rev` field from the lockfile for it to be repaired
  after the `:restart`.
This commit is contained in:
Evgeni Chasnovski
2026-04-10 18:36:04 +03:00
committed by GitHub
parent c1c2648284
commit 94c0e54e5b

View File

@@ -128,7 +128,10 @@ local function check_plugin_lock_data(plug_name, lock_data)
('Plugin %s is not at expected revision\n'):format(name_str)
.. ('Expected: %s\nActual: %s\n'):format(lock_data.rev, head)
.. 'To synchronize, restart Nvim and run '
.. ('`vim.pack.update({ %s }, { offline = true })`'):format(name_str)
.. ('`vim.pack.update({ %s }, { offline = true })`\n'):format(name_str)
.. 'If there are no updates, delete `rev` lockfile entry (do not create trailing comma) '
.. 'and restart Nvim to regenerate lockfile data\n'
.. 'This can happen after updating plugins with read-only `$XDG_CONFIG_HOME`'
)
return false
end