From 1a5d41a48fcc57043b03d0da2f3ad743203d81da Mon Sep 17 00:00:00 2001 From: Evgeni Chasnovski Date: Fri, 10 Apr 2026 18:36:04 +0300 Subject: [PATCH] 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`. (cherry picked from commit 94c0e54e5b93049274031a0bc59c831ad40db201) --- runtime/lua/vim/pack/health.lua | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/runtime/lua/vim/pack/health.lua b/runtime/lua/vim/pack/health.lua index c2bc88afcb..1590530fba 100644 --- a/runtime/lua/vim/pack/health.lua +++ b/runtime/lua/vim/pack/health.lua @@ -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