fix(git): use 3-arg --cacheinfo to survive commas in paths

This commit is contained in:
2026-04-27 14:28:20 +02:00
parent 0e0edbc418
commit 0fb84379c0
+6 -1
View File
@@ -39,11 +39,16 @@ local function attach_index_writer(buf, worktree, path)
end end
vim.b[buf].git_index_mode = mode vim.b[buf].git_index_mode = mode
end end
-- Use the 3-arg form (mode sha path) instead of the comma form
-- (mode,sha,path), which doesn't survive paths containing a
-- comma.
local upd = vim.system({ local upd = vim.system({
"git", "git",
"update-index", "update-index",
"--cacheinfo", "--cacheinfo",
mode .. "," .. sha .. "," .. path, mode,
sha,
path,
}, { cwd = worktree, text = true }):wait() }, { cwd = worktree, text = true }):wait()
if upd.code ~= 0 then if upd.code ~= 0 then
log.error("git update-index failed: %s", upd.stderr or "") log.error("git update-index failed: %s", upd.stderr or "")