Skip to content

Commit 19da9f0

Browse files
committed
feat(commit): also display pre-commit hook results when passing
1 parent 49b0e36 commit 19da9f0

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

lua/tinygit/commands/commit.lua

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -131,14 +131,15 @@ function M.smartCommit(opts)
131131
if package.loaded["snacks"] then require("snacks").notifier.hide() end
132132

133133
-- don't open input if hook fails
134+
local msg = (hookResult.stdout or "") .. (hookResult.stderr or "")
134135
if hookResult.code ~= 0 then
135-
local msg = (hookResult.stdout or "") .. (hookResult.stderr or "")
136-
msg = "[Pre-commit hook failed]\n\n" .. msg
136+
msg = "[Pre-commit hook failed]\n" .. msg
137137
u.notify(msg, "error", { timeout = 0 }) -- no timeout, since relevant for user
138-
return
138+
else
139+
msg = "[Pre-commit hook result]\n" .. msg
140+
u.notify(msg)
141+
startCommit()
139142
end
140-
141-
startCommit()
142143
end)
143144
)
144145
else

0 commit comments

Comments
 (0)