mirror of
https://github.com/neovim/neovim.git
synced 2026-11-03 12:49:53 -06: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:
1 parent
9595f07425
commit
3d37aa3116
1 file changed
+11
-7
@@ -137,13 +137,17 @@ local function check_plugin_lock_data(plug_name, lock_data)
|
|||||||
if not has_origin then
|
if not has_origin then
|
||||||
return failed_git_cmd(plug_name, plug_path)
|
return failed_git_cmd(plug_name, plug_path)
|
||||||
elseif lock_data.src ~= origin then
|
elseif lock_data.src ~= origin then
|
||||||
health.error(
|
-- Check if lockfile source relies on "insteadOf" Git config
|
||||||
('Plugin %s has not expected source\n'):format(name_str)
|
local ok, src_resolved = git_cmd({ 'ls-remote', '--get-url', lock_data.src }, plug_path)
|
||||||
.. ('Expected: %s\nActual: %s\n'):format(lock_data.src, origin)
|
if not (ok and src_resolved == origin) then
|
||||||
.. 'Delete `src` lockfile entry (do not create trailing comma) and '
|
health.error(
|
||||||
.. 'restart Nvim to regenerate lockfile data'
|
('Plugin %s has not expected source\n'):format(name_str)
|
||||||
)
|
.. ('Expected: %s\nActual: %s\n'):format(lock_data.src, origin)
|
||||||
return false
|
.. 'Delete `src` lockfile entry (do not create trailing comma) and '
|
||||||
|
.. 'restart Nvim to regenerate lockfile data'
|
||||||
|
)
|
||||||
|
return false
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
return true
|
return true
|
||||||
|
|||||||
Reference in new issue
Block a user