chore(git): consistent error reporting on git failures
This commit is contained in:
+13
-2
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user