chore(git): consistent error reporting on git failures

This commit is contained in:
2026-04-27 13:33:09 +02:00
parent 20dc6cc3c9
commit 6e0e05ae56
5 changed files with 81 additions and 14 deletions
+13 -2
View File
@@ -62,8 +62,19 @@ local function read_show(worktree, revspec)
{ cwd = worktree, text = true }
)
:wait()
local content = result.code == 0 and (result.stdout or "") or ""
local lines = vim.split(content, "\n", { plain = true, trimempty = false })
if result.code ~= 0 then
log.error(
"git show %s failed: %s",
revspec,
vim.trim(result.stderr or "")
)
return {}
end
local lines = vim.split(
result.stdout or "",
"\n",
{ plain = true, trimempty = false }
)
if #lines > 0 and lines[#lines] == "" then
table.remove(lines)
end