aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim/pack.lua
diff options
context:
space:
mode:
authorEvgeni Chasnovski <evgeni.chasnovski@gmail.com>2026-01-12 15:53:36 +0200
committerEvgeni Chasnovski <evgeni.chasnovski@gmail.com>2026-01-12 15:53:36 +0200
commit8f0b8a2c279f42d5af83b7517e4a19cacd21bfbe (patch)
tree49ad7a9553e9a1939bb9ea1448b16cac621483c5 /runtime/lua/vim/pack.lua
parent025c0c34ce597484db01850cc1576b488bc84986 (diff)
downloadrneovim-8f0b8a2c279f42d5af83b7517e4a19cacd21bfbe.tar.gz
rneovim-8f0b8a2c279f42d5af83b7517e4a19cacd21bfbe.tar.bz2
rneovim-8f0b8a2c279f42d5af83b7517e4a19cacd21bfbe.zip
fix(pack): skip `git stash` during install
Problem: Installing plugin is done via `git clone --no-checkout ...` (to not end up with default branch code in case of invalid `version`). This leaves cloned repo in a state that `git stash` will actually add an entry to the stash list. Although not critical, better to not have that if possible. Solution: explicitly skip `git stash` step in checkout during install.
Diffstat (limited to 'runtime/lua/vim/pack.lua')
-rw-r--r--runtime/lua/vim/pack.lua17
1 files changed, 10 insertions, 7 deletions
diff --git a/runtime/lua/vim/pack.lua b/runtime/lua/vim/pack.lua
index 13a97fa334..7b0aebaff9 100644
--- a/runtime/lua/vim/pack.lua
+++ b/runtime/lua/vim/pack.lua
@@ -654,15 +654,18 @@ end
--- @async
--- @param p vim.pack.Plug
--- @param timestamp string
-local function checkout(p, timestamp)
+--- @param skip_stash? boolean
+local function checkout(p, timestamp, skip_stash)
infer_revisions(p)
- local stash_cmd = { 'stash', '--quiet' }
- if git_version > vim.version.parse('2.13') then
- stash_cmd[#stash_cmd + 1] = '--message'
- stash_cmd[#stash_cmd + 1] = ('vim.pack: %s Stash before checkout'):format(timestamp)
+ if not skip_stash then
+ local stash_cmd = { 'stash', '--quiet' }
+ if git_version > vim.version.parse('2.13') then
+ stash_cmd[#stash_cmd + 1] = '--message'
+ stash_cmd[#stash_cmd + 1] = ('vim.pack: %s Stash before checkout'):format(timestamp)
+ end
+ git_cmd(stash_cmd, p.path)
end
- git_cmd(stash_cmd, p.path)
git_cmd({ 'checkout', '--quiet', p.info.sha_target }, p.path)
@@ -691,7 +694,7 @@ local function install_list(plug_list, confirm)
-- Prefer revision from the lockfile instead of using `version`
p.info.sha_target = (plugin_lock.plugins[p.spec.name] or {}).rev
- checkout(p, timestamp)
+ checkout(p, timestamp, true)
p.info.installed = true
trigger_event(p, 'PackChanged', 'install')