mirror of
https://github.com/neovim/neovim.git
synced 2026-03-31 04:42:03 +00:00
fix(pack): account for Git's "insteadOf" in :checkhealth #38393
Problem: It is possible (and documented in `:h vim.pack`) that plugin's `src` uses "insteadOf" Git config. In that case comparing it directly to repo's `origin` will error. Solution: Add extra check that lockfile's `src` is not equal to repo's `origin` when taking Git's "insteadOf" into account. However, still report the original lockfile's `src` in the `:checkhealth` output, as it seems to be a clearer indication of what actually is wrong.
This commit is contained in:
committed by
GitHub
parent
9595f07425
commit
3d37aa3116
@@ -137,13 +137,17 @@ local function check_plugin_lock_data(plug_name, lock_data)
|
||||
if not has_origin then
|
||||
return failed_git_cmd(plug_name, plug_path)
|
||||
elseif lock_data.src ~= origin then
|
||||
health.error(
|
||||
('Plugin %s has not expected source\n'):format(name_str)
|
||||
.. ('Expected: %s\nActual: %s\n'):format(lock_data.src, origin)
|
||||
.. 'Delete `src` lockfile entry (do not create trailing comma) and '
|
||||
.. 'restart Nvim to regenerate lockfile data'
|
||||
)
|
||||
return false
|
||||
-- Check if lockfile source relies on "insteadOf" Git config
|
||||
local ok, src_resolved = git_cmd({ 'ls-remote', '--get-url', lock_data.src }, plug_path)
|
||||
if not (ok and src_resolved == origin) then
|
||||
health.error(
|
||||
('Plugin %s has not expected source\n'):format(name_str)
|
||||
.. ('Expected: %s\nActual: %s\n'):format(lock_data.src, origin)
|
||||
.. 'Delete `src` lockfile entry (do not create trailing comma) and '
|
||||
.. 'restart Nvim to regenerate lockfile data'
|
||||
)
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
return true
|
||||
|
||||
Reference in New Issue
Block a user