fix(pack): make 'stash' call compatible with older Git #38679

Problem:
On Git versions 2.13..2.26 there is a bug that prevents using
`stash --message`.

Solution:
Use the full `stash push --message` form to avoid that bug.

(cherry picked from commit 38aec2d3cd)
This commit is contained in:
skewb1k
2026-04-11 17:37:37 +03:00
committed by github-actions[bot]
parent 6b86f5520d
commit df3d7e36d0

View File

@@ -664,11 +664,14 @@ local function checkout(p, timestamp, skip_stash)
infer_revisions(p)
if not skip_stash then
local stash_cmd = { 'stash', '--quiet' }
local stash_cmd = { 'stash' }
if git_version > vim.version.parse('2.13') then
-- Use 'push' to avoid a 'stash -m' bug in versions prior to git v2.26
stash_cmd[#stash_cmd + 1] = 'push'
stash_cmd[#stash_cmd + 1] = '--message'
stash_cmd[#stash_cmd + 1] = ('vim.pack: %s Stash before checkout'):format(timestamp)
end
stash_cmd[#stash_cmd + 1] = '--quiet'
git_cmd(stash_cmd, p.path)
end