mirror of
https://github.com/TimUntersberger/neogit
synced 2024-09-07 18:24:57 +02:00
Merge pull request #1431 from ej-shafran/cherry-pick-options
This commit is contained in:
commit
2b74a777b9
3 changed files with 27 additions and 11 deletions
|
@ -1,6 +1,7 @@
|
|||
local git = require("neogit.lib.git")
|
||||
local notification = require("neogit.lib.notification")
|
||||
local util = require("neogit.lib.util")
|
||||
local client = require("neogit.client")
|
||||
|
||||
---@class NeogitGitCherryPick
|
||||
local M = {}
|
||||
|
@ -10,7 +11,15 @@ local function fire_cherrypick_event(data)
|
|||
end
|
||||
|
||||
function M.pick(commits, args)
|
||||
local result = git.cli["cherry-pick"].arg_list(util.merge(args, commits)).call { await = true }
|
||||
local cmd = git.cli["cherry-pick"].arg_list(util.merge(args, commits))
|
||||
|
||||
local result
|
||||
if vim.tbl_contains(args, "--edit") then
|
||||
result = cmd.env(client.get_envs_git_editor()).call { pty = true }
|
||||
else
|
||||
result = cmd.call { await = true }
|
||||
end
|
||||
|
||||
if result.code ~= 0 then
|
||||
notification.error("Cherry Pick failed. Resolve conflicts before continuing")
|
||||
else
|
||||
|
|
|
@ -7,18 +7,25 @@ local M = {}
|
|||
function M.create(env)
|
||||
local in_progress = git.sequencer.pick_or_revert_in_progress()
|
||||
|
||||
-- TODO
|
||||
-- :switch("x", "x", "Reference cherry in commit message", { cli_prefix = "-" })
|
||||
-- :switch("e", "edit", "Edit commit messages", false)
|
||||
-- :switch("s", "signoff", "Add Signed-off-by lines", false)
|
||||
-- :option("m", "mainline", "", "Replay merge relative to parent")
|
||||
-- :option("s", "strategy", "", "Strategy")
|
||||
-- :option("S", "gpg-sign", "", "Sign using gpg")
|
||||
|
||||
local p = popup
|
||||
.builder()
|
||||
:name("NeogitCherryPickPopup")
|
||||
:switch_if(not in_progress, "F", "ff", "Attempt fast-forward", { enabled = true })
|
||||
:option_if(not in_progress, "m", "mainline", "", "Replay merge relative to parent", { key_prefix = "-" })
|
||||
:option_if(not in_progress, "s", "strategy", "", "Strategy", {
|
||||
key_prefix = "=",
|
||||
choices = { "octopus", "ours", "resolve", "subtree", "recursive" },
|
||||
})
|
||||
:switch_if(
|
||||
not in_progress,
|
||||
"F",
|
||||
"ff",
|
||||
"Attempt fast-forward",
|
||||
{ enabled = true, incompatible = { "edit" } }
|
||||
)
|
||||
:switch_if(not in_progress, "x", "x", "Reference cherry in commit message", { cli_prefix = "-" })
|
||||
:switch_if(not in_progress, "e", "edit", "Edit commit messages", { incompatible = { "ff" } })
|
||||
:switch_if(not in_progress, "s", "signoff", "Add Signed-off-by lines")
|
||||
:option_if(not in_progress, "S", "gpg-sign", "", "Sign using gpg", { key_prefix = "-" })
|
||||
:group_heading_if(not in_progress, "Apply here")
|
||||
:action_if(not in_progress, "A", "Pick", actions.pick)
|
||||
:action_if(not in_progress, "a", "Apply", actions.apply)
|
||||
|
|
|
@ -15,7 +15,7 @@ function M.create(env)
|
|||
:switch_if(not in_merge, "f", "ff-only", "Fast-forward only", { incompatible = { "no-ff" } })
|
||||
:switch_if(not in_merge, "n", "no-ff", "No fast-forward", { incompatible = { "ff-only" } })
|
||||
:option_if(not in_merge, "s", "strategy", "", "Strategy", {
|
||||
choices = { "resolve", "recursive", "octopus", "ours", "subtree" },
|
||||
choices = { "octopus", "ours", "resolve", "subtree", "recursive" },
|
||||
key_prefix = "-",
|
||||
})
|
||||
:option_if(not in_merge, "X", "strategy-option", "", "Strategy Option", {
|
||||
|
|
Loading…
Reference in a new issue