mirror of
https://github.com/neovim/neovim.git
synced 2026-07-24 18:00:46 +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
@@ -16,8 +16,8 @@
|
||||
---Like `v1.2.0` or `1.2.0`, but not `1.2` or `v1`.
|
||||
---
|
||||
---The latest state of all managed plugins is stored inside a [vim.pack-lockfile]()
|
||||
---located at `$XDG_CONFIG_HOME/nvim/nvim-pack-lock.json`. It is a JSON file that
|
||||
---is used to persistently track data about plugins.
|
||||
---located at |'packlockfile'|.
|
||||
---It is a JSON file that is used to persistently track data about plugins.
|
||||
---For a more robust config treat lockfile like its part: put under version control, etc.
|
||||
---In this case all plugins from the lockfile will be installed at once (in alphabetical order) and
|
||||
---at lockfile's revision (instead of inferring from `version`). This is done on the very first
|
||||
@@ -258,10 +258,6 @@ local function get_plug_dir()
|
||||
return vim.fs.joinpath(vim.fn.stdpath('data'), 'site', 'pack', 'core', 'opt')
|
||||
end
|
||||
|
||||
local function lock_get_path()
|
||||
return vim.fs.joinpath(vim.fn.stdpath('config'), 'nvim-pack-lock.json')
|
||||
end
|
||||
|
||||
-- Git ------------------------------------------------------------------------
|
||||
|
||||
--- @async
|
||||
@@ -871,9 +867,8 @@ local function lock_write()
|
||||
end
|
||||
end
|
||||
|
||||
local path = lock_get_path()
|
||||
vim.fn.mkdir(vim.fs.dirname(path), 'p')
|
||||
local fd = assert(uv.fs_open(path, 'w', 438))
|
||||
vim.fn.mkdir(vim.fs.dirname(M._plugin_lock_path), 'p')
|
||||
local fd = assert(uv.fs_open(M._plugin_lock_path, 'w', 438))
|
||||
|
||||
local data = vim.json.encode(lock, { indent = ' ', sort_keys = true })
|
||||
assert(uv.fs_write(fd, data .. '\n'))
|
||||
@@ -998,7 +993,8 @@ local function lock_read(confirm, specs)
|
||||
return
|
||||
end
|
||||
|
||||
local fd = uv.fs_open(lock_get_path(), 'r', 438)
|
||||
M._plugin_lock_path = vim.go.packlockfile
|
||||
local fd = uv.fs_open(M._plugin_lock_path, 'r', 438)
|
||||
if fd then
|
||||
local stat = assert(uv.fs_fstat(fd))
|
||||
local data = assert(uv.fs_read(fd, stat.size, 0))
|
||||
|
||||
Reference in New Issue
Block a user