aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim/pack.lua
diff options
context:
space:
mode:
authorEvgeni Chasnovski <evgeni.chasnovski@gmail.com>2026-05-17 10:49:48 +0300
committerEvgeni Chasnovski <evgeni.chasnovski@gmail.com>2026-05-17 10:49:48 +0300
commit8d100483e0662916cd30e99ceb7216532c58f903 (patch)
tree1db557fff7f0cb2a6479f3935f2dcb363433b27c /runtime/lua/vim/pack.lua
parent7d99104058fd2653903830c2b39b42d80092e646 (diff)
downloadrneovim-8d100483e0662916cd30e99ceb7216532c58f903.tar.gz
rneovim-8d100483e0662916cd30e99ceb7216532c58f903.tar.bz2
rneovim-8d100483e0662916cd30e99ceb7216532c58f903.zip
feat(pack): update `get()` to take `rev` from actual repo if `info=true`
Problem: `vim.pack.get()` always uses lockfile as the source for the `rev` field. This is fast, but may be misleading in case of a corrupted lockfile. Solution: Compute revision from Git repo on disk if `info=true` (default), use lockfile otherwise. This does increase execution time (as a result of one extra `git ...` call for every plugin), but `info=true` is already designed to be informative and not necessarily fast.
Diffstat (limited to 'runtime/lua/vim/pack.lua')
-rw-r--r--runtime/lua/vim/pack.lua3
1 files changed, 2 insertions, 1 deletions
diff --git a/runtime/lua/vim/pack.lua b/runtime/lua/vim/pack.lua
index bd693904cd..655d6f14d6 100644
--- a/runtime/lua/vim/pack.lua
+++ b/runtime/lua/vim/pack.lua
@@ -1434,7 +1434,7 @@ end
--- @field active boolean Whether plugin was added via |vim.pack.add()| to current session.
--- @field branches? string[] Available Git branches (first is default). Missing if `info=false`.
--- @field path string Plugin's path on disk.
---- @field rev string Current Git revision.
+--- @field rev string Current Git revision. Taken from |vim.pack-lockfile| if `info=false`.
--- @field spec vim.pack.SpecResolved A |vim.pack.Spec| with resolved `name`.
--- @field tags? string[] Available Git tags. Missing if `info=false`.
@@ -1450,6 +1450,7 @@ local function add_p_data_info(p_data_list)
--- @async
funs[i] = function()
p_data.branches = git_get_branches(path)
+ p_data.rev = git_get_hash('HEAD', path)
p_data.tags = git_get_tags(path)
end
end