refactor(git): convert blocking subprocess calls to async

This commit is contained in:
2026-04-27 16:02:14 +02:00
parent 00eae8dbb9
commit 6a86a75ed5
8 changed files with 338 additions and 253 deletions
+20 -14
View File
@@ -67,20 +67,26 @@ function M.commit(opts)
if amend then
table.insert(cmd, "--amend")
end
local result = vim.system(cmd, { cwd = worktree, text = true })
:wait()
if result.code ~= 0 then
log.error(
"git commit failed: %s",
vim.trim(result.stderr or "")
)
return
end
local out = vim.trim(result.stdout or "")
if out ~= "" then
log.info("%s", out)
end
vim.api.nvim_buf_delete(buf, { force = true })
vim.system(
cmd,
{ cwd = worktree, text = true },
vim.schedule_wrap(function(result)
if result.code ~= 0 then
log.error(
"git commit failed: %s",
vim.trim(result.stderr or "")
)
return
end
local out = vim.trim(result.stdout or "")
if out ~= "" then
log.info("%s", out)
end
if vim.api.nvim_buf_is_valid(buf) then
vim.api.nvim_buf_delete(buf, { force = true })
end
end)
)
end,
})
end