Repository navigation
Replies: 4 comments 5 replies
|
Use Commit Startup lock-checkouts plugins that are missing. Plugins already on disk are left alone, which is why a later write can "downgrade" the lockfile to older local HEADs. If git shows a dirty lockfile after that,
|
|
Ok what you've said will work by the sound of it but I dislike the extra step to check for a dirty lockfile again. Also the chance of committing the wrong lockfile seems too high. Once you've got more than one machine I think it's going to be chaotic. How about this:
Just seems like lazy should be doing this itself? |
|
The "downgrade" comes from lazy caching the lockfile. Run the restore in a fresh process after pulling: git -C ~/.config/nvim pull
nvim --headless "+Lazy! restore" +qa
If you want to do it from an open session, reset the cache first (internal field, so it could change): :lua require("lazy.manage.lock")._loaded = false
:Lazy restoreI tested this with two plugins and a lockfile pinned to older commits. Pulling while nvim was open and then running One caveat: a plugin in your spec that is missing from the lockfile still goes to latest, since there is nothing to restore it to. So commit the lockfile on the machine where you add a plugin. |
|
I always close all nvims before doing a restore so it's not the cache problem for me, but thanks for that info as it could affect others. I think I've narrowed down what I'm seeing when using restore: If a plugin is missing from disk during restore then neovim will take the latest of some(*) plugins regardless of what is in the lock file. (* = really not sure why it's some and not others right now.) @abhiramshaji-cyber could you redo your test and delete plugins from disk between restores? See if you get a changed lock file like me. This is what happens on machines that have not seen a new plugin yet. As @shreechaturvedi has said, there's a interplay between what's on disk and what's in the lock file and it's not always the lock file that wins. I am seeing upgrades though, not downgrades. So, for now, a perfect sync looks like this (basically what @shreechaturvedi already suggested):
Restore (2) should now leave the lock file untouched as all plugins in the lock file were put on disk by the Restore (1). |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Hi,
I'm trying to keep multiple machines at the exact same plugin versions via a shared lockfile. However I am finding:
There's quite a few issues been raised about this, all closed as not planned:
On the positive side there's a suggested (partial?) fix open since Feb: #2127
(Update: from my testing this does not work as missing plugins get updated to latest, ignoring the lockfile) It seems the only way Lazy will leave the lockfile untouched is if a plugin is missing. So, worst case, you could delete all plugins before starting nvim and you would then get the agreed versions in the lockfile. However that's a lot of wasted downloading and installing.
How is anyone else managing this?
All reactions