mirror of
https://github.com/TimUntersberger/neogit
synced 2024-09-16 14:24:09 +02:00
Merge branch 'master' into cherry-pick-options
This commit is contained in:
commit
0ff7933895
7 changed files with 9 additions and 26 deletions
|
@ -147,8 +147,7 @@ function M.wrap(cmd, opts)
|
||||||
end
|
end
|
||||||
|
|
||||||
logger.debug("[CLIENT] Calling editor command")
|
logger.debug("[CLIENT] Calling editor command")
|
||||||
local result =
|
local result = cmd.env(M.get_envs_git_editor(opts.show_diff)).call { pty = opts.interactive }
|
||||||
cmd.env(M.get_envs_git_editor(opts.show_diff)).call { verbose = true, pty = opts.interactive }
|
|
||||||
|
|
||||||
a.util.scheduler()
|
a.util.scheduler()
|
||||||
logger.debug("[CLIENT] DONE editor command")
|
logger.debug("[CLIENT] DONE editor command")
|
||||||
|
|
|
@ -967,14 +967,12 @@ local function new_builder(subcommand)
|
||||||
cwd = git.repo.git_root,
|
cwd = git.repo.git_root,
|
||||||
env = state.env,
|
env = state.env,
|
||||||
pty = state.in_pty,
|
pty = state.in_pty,
|
||||||
verbose = opts.verbose,
|
|
||||||
on_error = opts.on_error,
|
on_error = opts.on_error,
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
local function make_options(options)
|
local function make_options(options)
|
||||||
local opts = vim.tbl_extend("keep", (options or {}), {
|
local opts = vim.tbl_extend("keep", (options or {}), {
|
||||||
verbose = false,
|
|
||||||
hidden = false,
|
hidden = false,
|
||||||
trim = true,
|
trim = true,
|
||||||
remove_ansi = true,
|
remove_ansi = true,
|
||||||
|
@ -998,7 +996,6 @@ local function new_builder(subcommand)
|
||||||
call = function(options)
|
call = function(options)
|
||||||
local opts = make_options(options)
|
local opts = make_options(options)
|
||||||
local p = to_process {
|
local p = to_process {
|
||||||
verbose = opts.verbose,
|
|
||||||
on_error = function(res)
|
on_error = function(res)
|
||||||
-- When aborting, don't alert the user. exit(1) is expected.
|
-- When aborting, don't alert the user. exit(1) is expected.
|
||||||
for _, line in ipairs(res.stdout) do
|
for _, line in ipairs(res.stdout) do
|
||||||
|
|
|
@ -150,7 +150,6 @@ function M.update()
|
||||||
require("neogit.process")
|
require("neogit.process")
|
||||||
.new({
|
.new({
|
||||||
cmd = { "git", "update-index", "-q", "--refresh" },
|
cmd = { "git", "update-index", "-q", "--refresh" },
|
||||||
verbose = false,
|
|
||||||
on_error = function(_)
|
on_error = function(_)
|
||||||
return false
|
return false
|
||||||
end,
|
end,
|
||||||
|
|
|
@ -2,13 +2,11 @@ local client = require("neogit.client")
|
||||||
local git = require("neogit.lib.git")
|
local git = require("neogit.lib.git")
|
||||||
local notification = require("neogit.lib.notification")
|
local notification = require("neogit.lib.notification")
|
||||||
|
|
||||||
local a = require("plenary.async")
|
|
||||||
|
|
||||||
---@class NeogitGitMerge
|
---@class NeogitGitMerge
|
||||||
local M = {}
|
local M = {}
|
||||||
|
|
||||||
local function merge_command(cmd)
|
local function merge_command(cmd)
|
||||||
return cmd.env(client.get_envs_git_editor()).call { verbose = true, pty = true }
|
return cmd.env(client.get_envs_git_editor()).call { pty = true }
|
||||||
end
|
end
|
||||||
|
|
||||||
local function fire_merge_event(data)
|
local function fire_merge_event(data)
|
||||||
|
@ -16,7 +14,6 @@ local function fire_merge_event(data)
|
||||||
end
|
end
|
||||||
|
|
||||||
function M.merge(branch, args)
|
function M.merge(branch, args)
|
||||||
a.util.scheduler()
|
|
||||||
local result = merge_command(git.cli.merge.args(branch).arg_list(args))
|
local result = merge_command(git.cli.merge.args(branch).arg_list(args))
|
||||||
if result.code ~= 0 then
|
if result.code ~= 0 then
|
||||||
notification.error("Merging failed. Resolve conflicts before continuing")
|
notification.error("Merging failed. Resolve conflicts before continuing")
|
||||||
|
|
|
@ -11,7 +11,7 @@ local function fire_rebase_event(data)
|
||||||
end
|
end
|
||||||
|
|
||||||
local function rebase_command(cmd)
|
local function rebase_command(cmd)
|
||||||
return cmd.env(client.get_envs_git_editor()).call { verbose = true, long = true, pty = true }
|
return cmd.env(client.get_envs_git_editor()).call { long = true, pty = true }
|
||||||
end
|
end
|
||||||
|
|
||||||
---Instant rebase. This is a way to rebase without using the interactive editor
|
---Instant rebase. This is a way to rebase without using the interactive editor
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
local M = {}
|
local M = {}
|
||||||
local config = require("neogit.config")
|
local config = require("neogit.config")
|
||||||
local util = require("neogit.lib.util")
|
|
||||||
|
|
||||||
---@param message string message to send
|
---@param message string message to send
|
||||||
---@param level integer vim.log.levels.X
|
---@param level integer vim.log.levels.X
|
||||||
|
@ -11,11 +10,7 @@ local function create(message, level, opts)
|
||||||
end
|
end
|
||||||
|
|
||||||
vim.schedule(function()
|
vim.schedule(function()
|
||||||
vim.notify(
|
vim.notify(message, level, { title = "Neogit", icon = config.values.notification_icon })
|
||||||
util.remove_ansi_escape_codes(message),
|
|
||||||
level,
|
|
||||||
{ title = "Neogit", icon = config.values.notification_icon }
|
|
||||||
)
|
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,6 @@ end
|
||||||
---@field cmd string[]
|
---@field cmd string[]
|
||||||
---@field cwd string|nil
|
---@field cwd string|nil
|
||||||
---@field env table<string, string>|nil
|
---@field env table<string, string>|nil
|
||||||
---@field verbose boolean If true, stdout will be written to the console buffer
|
|
||||||
---@field result ProcessResult|nil
|
---@field result ProcessResult|nil
|
||||||
---@field job number|nil
|
---@field job number|nil
|
||||||
---@field stdin number|nil
|
---@field stdin number|nil
|
||||||
|
@ -278,16 +277,13 @@ function Process:spawn(cb)
|
||||||
|
|
||||||
if not self.buffer:is_visible() and code > 0 and self.on_error(res) then
|
if not self.buffer:is_visible() and code > 0 and self.on_error(res) then
|
||||||
local output = {}
|
local output = {}
|
||||||
local start = math.max(#res.output - 16, 1)
|
local start = math.max(#res.stderr - 16, 1)
|
||||||
for i = start, math.min(#res.output, start + 16) do
|
for i = start, math.min(#res.stderr, start + 16) do
|
||||||
insert(output, " " .. res.output[i])
|
insert(output, "> " .. util.remove_ansi_escape_codes(res.stderr[i]))
|
||||||
end
|
end
|
||||||
|
|
||||||
local message = string.format(
|
local message =
|
||||||
"%s:\n\n%s\n\nAn error occurred.",
|
string.format("%s:\n\n%s", mask_command(table.concat(self.cmd, " ")), table.concat(output, "\n"))
|
||||||
mask_command(table.concat(self.cmd, " ")),
|
|
||||||
table.concat(output, "\n")
|
|
||||||
)
|
|
||||||
|
|
||||||
notification.warn(message)
|
notification.warn(message)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue