aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim/pack.lua
diff options
context:
space:
mode:
authorEvgeni Chasnovski <evgeni.chasnovski@gmail.com>2026-01-12 22:57:38 +0200
committerEvgeni Chasnovski <evgeni.chasnovski@gmail.com>2026-01-12 22:57:38 +0200
commitbac4cde9cd43dcb1bb962d71f3f9253813a701a3 (patch)
tree26c50c7729953ad490e9f5eac14bad5b90d4964c /runtime/lua/vim/pack.lua
parent09edb145f5f3d10aadc9ba45358cdb1a0f166534 (diff)
downloadrneovim-bac4cde9cd43dcb1bb962d71f3f9253813a701a3.tar.gz
rneovim-bac4cde9cd43dcb1bb962d71f3f9253813a701a3.tar.bz2
rneovim-bac4cde9cd43dcb1bb962d71f3f9253813a701a3.zip
fix(pack): actually checkout proper version of submodules
Problem: Installing plugin with submodules doesn't check out their state (due to `git clone --no-checkout` to not end up with default branch code in case of invalid `version`). Updating a plugin with submodules doesn't update their state. Solution: Update `git_checkout` helper to account for submodules. Another approach would be `git checkout --recurse-submodules ...`, but that doesn't seem to allow `--filter=blob:none` for submodules, which is nice to have. Also make `git_clone` wrapper simpler since `--no-checkout` makes `--recurse-submodules` and `--also-filter-submodules` do nothing.
Diffstat (limited to 'runtime/lua/vim/pack.lua')
-rw-r--r--runtime/lua/vim/pack.lua17
1 files changed, 9 insertions, 8 deletions
diff --git a/runtime/lua/vim/pack.lua b/runtime/lua/vim/pack.lua
index 7b0aebaff9..9aabc91351 100644
--- a/runtime/lua/vim/pack.lua
+++ b/runtime/lua/vim/pack.lua
@@ -264,17 +264,12 @@ end
--- @param url string
--- @param path string
local function git_clone(url, path)
- local cmd = { 'clone', '--quiet', '--no-checkout', '--recurse-submodules' }
+ local cmd = { 'clone', '--quiet', '--no-checkout' }
if vim.startswith(url, 'file://') then
cmd[#cmd + 1] = '--no-hardlinks'
- else
- if git_version >= vim.version.parse('2.36') then
- cmd[#cmd + 1] = '--filter=blob:none'
- cmd[#cmd + 1] = '--also-filter-submodules'
- elseif git_version >= vim.version.parse('2.27') then
- cmd[#cmd + 1] = '--filter=blob:none'
- end
+ elseif git_version >= vim.version.parse('2.27') then
+ cmd[#cmd + 1] = '--filter=blob:none'
end
vim.list_extend(cmd, { '--origin', 'origin', url, path })
@@ -669,6 +664,12 @@ local function checkout(p, timestamp, skip_stash)
git_cmd({ 'checkout', '--quiet', p.info.sha_target }, p.path)
+ local submodule_cmd = { 'submodule', 'update', '--init', '--recursive' }
+ if git_version >= vim.version.parse('2.36') then
+ submodule_cmd[#submodule_cmd + 1] = '--filter=blob:none'
+ end
+ git_cmd(submodule_cmd, p.path)
+
plugin_lock.plugins[p.spec.name].rev = p.info.sha_target
-- (Re)Generate help tags according to the current help files.