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 "")