From 0fb84379c01ce593edfb4c8e4649054b99ad39bf Mon Sep 17 00:00:00 2001 From: Oscar Wallberg Date: Mon, 27 Apr 2026 14:28:20 +0200 Subject: [PATCH] fix(git): use 3-arg --cacheinfo to survive commas in paths --- lua/git/diff.lua | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lua/git/diff.lua b/lua/git/diff.lua index dde60da..6374fc6 100644 --- a/lua/git/diff.lua +++ b/lua/git/diff.lua @@ -39,11 +39,16 @@ local function attach_index_writer(buf, worktree, path) end vim.b[buf].git_index_mode = mode 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({ "git", "update-index", "--cacheinfo", - mode .. "," .. sha .. "," .. path, + mode, + sha, + path, }, { cwd = worktree, text = true }):wait() if upd.code ~= 0 then log.error("git update-index failed: %s", upd.stderr or "")