mirror of
https://github.com/TimUntersberger/neogit
synced 2024-09-16 14:24:09 +02:00
Merge pull request #1436 from NeogitOrg/fix-notifications
This commit is contained in:
commit
8a2c37a780
3 changed files with 6 additions and 17 deletions
|
@ -2,8 +2,6 @@ local client = require("neogit.client")
|
|||
local git = require("neogit.lib.git")
|
||||
local notification = require("neogit.lib.notification")
|
||||
|
||||
local a = require("plenary.async")
|
||||
|
||||
---@class NeogitGitMerge
|
||||
local M = {}
|
||||
|
||||
|
@ -16,7 +14,6 @@ local function fire_merge_event(data)
|
|||
end
|
||||
|
||||
function M.merge(branch, args)
|
||||
a.util.scheduler()
|
||||
local result = merge_command(git.cli.merge.args(branch).arg_list(args))
|
||||
if result.code ~= 0 then
|
||||
notification.error("Merging failed. Resolve conflicts before continuing")
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
local M = {}
|
||||
local config = require("neogit.config")
|
||||
local util = require("neogit.lib.util")
|
||||
|
||||
---@param message string message to send
|
||||
---@param level integer vim.log.levels.X
|
||||
|
@ -11,11 +10,7 @@ local function create(message, level, opts)
|
|||
end
|
||||
|
||||
vim.schedule(function()
|
||||
vim.notify(
|
||||
util.remove_ansi_escape_codes(message),
|
||||
level,
|
||||
{ title = "Neogit", icon = config.values.notification_icon }
|
||||
)
|
||||
vim.notify(message, level, { title = "Neogit", icon = config.values.notification_icon })
|
||||
end)
|
||||
end
|
||||
|
||||
|
|
|
@ -277,16 +277,13 @@ function Process:spawn(cb)
|
|||
|
||||
if not self.buffer:is_visible() and code > 0 and self.on_error(res) then
|
||||
local output = {}
|
||||
local start = math.max(#res.output - 16, 1)
|
||||
for i = start, math.min(#res.output, start + 16) do
|
||||
insert(output, " " .. res.output[i])
|
||||
local start = math.max(#res.stderr - 16, 1)
|
||||
for i = start, math.min(#res.stderr, start + 16) do
|
||||
insert(output, "> " .. util.remove_ansi_escape_codes(res.stderr[i]))
|
||||
end
|
||||
|
||||
local message = string.format(
|
||||
"%s:\n\n%s\n\nAn error occurred.",
|
||||
mask_command(table.concat(self.cmd, " ")),
|
||||
table.concat(output, "\n")
|
||||
)
|
||||
local message =
|
||||
string.format("%s:\n\n%s", mask_command(table.concat(self.cmd, " ")), table.concat(output, "\n"))
|
||||
|
||||
notification.warn(message)
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue