refactor(git): consolidate sync subprocess pattern via util.system_sync

This commit is contained in:
2026-04-28 08:38:14 +02:00
parent d2633ae9c2
commit 4390b55dfe
5 changed files with 57 additions and 67 deletions
+3 -10
View File
@@ -38,22 +38,15 @@ function M.show(opts)
table.insert(cmd, "--max-count=" .. max_count)
end
local result = vim.system(cmd, { cwd = worktree, text = true }):wait()
if result.code ~= 0 then
log.error("git log failed: %s", vim.trim(result.stderr or ""))
local stdout = util.system_sync(cmd, { cwd = worktree })
if not stdout then
return
end
local buf = git.new_scratch()
vim.b[buf].git_worktree = worktree
vim.bo[buf].modifiable = true
vim.api.nvim_buf_set_lines(
buf,
0,
-1,
false,
util.split_lines(result.stdout or "")
)
vim.api.nvim_buf_set_lines(buf, 0, -1, false, util.split_lines(stdout))
vim.bo[buf].modifiable = false
vim.bo[buf].modified = false
vim.bo[buf].filetype = "gitlog"