mirror of
https://github.com/neovim/neovim.git
synced 2026-07-21 16:41:38 +00:00
feat(pack): 'packlockfile' option #40562
Problem: No way to configure the lockfile location. Solution: Add 'packlockfile' option.
This commit is contained in:
committed by
GitHub
parent
ef130902cf
commit
0653e7a338
@@ -3,7 +3,7 @@ local M = {}
|
||||
local health = vim.health
|
||||
|
||||
local function get_lockfile_path()
|
||||
return vim.fs.joinpath(vim.fn.stdpath('config'), 'nvim-pack-lock.json')
|
||||
return vim.pack._plugin_lock_path or vim.go.packlockfile
|
||||
end
|
||||
|
||||
local function get_plug_dir()
|
||||
@@ -159,7 +159,8 @@ end
|
||||
local function check_lockfile()
|
||||
health.start('vim.pack: lockfile')
|
||||
|
||||
local can_read, text = pcall(vim.fn.readblob, get_lockfile_path())
|
||||
local path = get_lockfile_path()
|
||||
local can_read, text = pcall(vim.fn.readblob, path)
|
||||
if not can_read then
|
||||
health.error('Could not read lockfile. Delete it and restart Nvim.')
|
||||
return
|
||||
@@ -177,6 +178,18 @@ local function check_lockfile()
|
||||
end
|
||||
|
||||
local is_good = true
|
||||
if path ~= vim.go.packlockfile then
|
||||
health.warn(
|
||||
"Lockfile path is not the same as 'packlockfile' option value. "
|
||||
.. "Set 'packlockfile' before the first usage of `vim.pack` function."
|
||||
)
|
||||
is_good = false
|
||||
end
|
||||
if path ~= vim.fs.abspath(path) then
|
||||
health.warn('Lockfile path is not absolute. Make sure that this is intentional.')
|
||||
is_good = false
|
||||
end
|
||||
|
||||
--- @cast data { plugins: table<string,table> }
|
||||
for plug_name, lock_data in pairs(data.plugins) do
|
||||
is_good = check_plugin_lock_data(plug_name, lock_data) and is_good
|
||||
|
||||
Reference in New Issue
Block a user