From dfba0965a1155148a7067ca3dc03c6f98ed5ceaa Mon Sep 17 00:00:00 2001 From: Oleksandr Chekhovskyi Date: Wed, 4 Feb 2026 21:15:04 +0200 Subject: [PATCH] fix(manage): don't overwrite lockfile when lockfile=true MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When `lockfile=true` (used by `install.missing` on startup and `:Lazy restore`), the lockfile is the source of truth and should not be overwritten. Previously, `lock.update()` was called unconditionally after install/update, rewriting the entire lockfile from the current disk state of all plugins — discarding pinned versions for already-installed plugins. Skip `lock.update()` when `opts.lockfile` is set, so that: - startup auto-install (`install.missing`) no longer overwrites the lockfile - `:Lazy restore` no longer overwrites the lockfile - explicit `:Lazy install` and `:Lazy update` still update it Fixes #1279 --- lua/lazy/manage/init.lua | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lua/lazy/manage/init.lua b/lua/lazy/manage/init.lua index e28d9dd88..63e216dbd 100644 --- a/lua/lazy/manage/init.lua +++ b/lua/lazy/manage/init.lua @@ -99,7 +99,9 @@ function M.install(opts) return not (plugin._.installed and not plugin._.build) end, }, opts):wait(function() - require("lazy.manage.lock").update() + if not opts.lockfile then + require("lazy.manage.lock").update() + end require("lazy.help").update() end) end @@ -132,7 +134,9 @@ function M.update(opts) return plugin.url and plugin._.installed end, }, opts):wait(function() - require("lazy.manage.lock").update() + if not opts.lockfile then + require("lazy.manage.lock").update() + end require("lazy.help").update() end) end