refactor(git): keep routine success output out of :messages
This commit is contained in:
+1
-1
@@ -238,7 +238,7 @@ local function run_to_messages(r, args)
|
|||||||
)
|
)
|
||||||
end
|
end
|
||||||
if #chunks > 0 then
|
if #chunks > 0 then
|
||||||
vim.api.nvim_echo(chunks, true, {})
|
vim.api.nvim_echo(chunks, failed or err ~= "", {})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -72,7 +72,7 @@ function M.commit(opts)
|
|||||||
end
|
end
|
||||||
local out = vim.trim(result.stdout or "")
|
local out = vim.trim(result.stdout or "")
|
||||||
if out ~= "" then
|
if out ~= "" then
|
||||||
util.info("%s", out)
|
vim.api.nvim_echo({ { out } }, false, {})
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -509,6 +509,41 @@ local function has_status(calls, status)
|
|||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
---@param calls { history: boolean }[]
|
||||||
|
---@return boolean
|
||||||
|
local function any_history(calls)
|
||||||
|
for _, c in ipairs(calls) do
|
||||||
|
if c.history then
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
t.test("quiet :G success does not add to :messages history", function()
|
||||||
|
make_repo({ a = "x" })
|
||||||
|
with_echo_stub(function(calls)
|
||||||
|
cmd.run({ "config", "user.email" })
|
||||||
|
t.falsy(any_history(calls), "success path must not write history")
|
||||||
|
end)
|
||||||
|
end)
|
||||||
|
|
||||||
|
t.test("quiet :G silent failure adds 'git exited N' to history", function()
|
||||||
|
make_repo({ a = "x" })
|
||||||
|
with_echo_stub(function(calls)
|
||||||
|
cmd.run({ "config", "--get", "nonexistent.foo.bar" })
|
||||||
|
t.truthy(any_history(calls), "failure path must write history")
|
||||||
|
end)
|
||||||
|
end)
|
||||||
|
|
||||||
|
t.test("quiet :G stderr failure adds error to history", function()
|
||||||
|
make_repo({ a = "x" })
|
||||||
|
with_echo_stub(function(calls)
|
||||||
|
cmd.run({ "branch", "-d", "nonexistent-branch" })
|
||||||
|
t.truthy(any_history(calls), "failure path must write history")
|
||||||
|
end)
|
||||||
|
end)
|
||||||
|
|
||||||
t.test("streaming :G fetch (no bang) does not open a window", function()
|
t.test("streaming :G fetch (no bang) does not open a window", function()
|
||||||
make_repo({ a = "x" })
|
make_repo({ a = "x" })
|
||||||
with_echo_stub(function(calls)
|
with_echo_stub(function(calls)
|
||||||
|
|||||||
Reference in New Issue
Block a user