Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions lua/neogit/buffers/commit_view/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ local log = require("neogit.lib.git.log")
local config = require("neogit.config")

local CherryPickPopup = require("neogit.popups.cherry_pick")
local RevertPopup = require("neogit.popups.revert")

local api = vim.api

Expand Down Expand Up @@ -129,6 +130,9 @@ function M:open()
["A"] = function()
CherryPickPopup.create { commits = { self.commit_info.oid } }
end,
["_"] = function()
RevertPopup.create { commits = { self.commit_info.oid } }
end,
["q"] = function()
self:close()
end,
Expand Down
2 changes: 1 addition & 1 deletion lua/neogit/buffers/log_view/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ function M:open()
end,
["_"] = function()
local stack = self.buffer.ui:get_component_stack_under_cursor()
RevertPopup.create(stack[#stack].options.oid)
RevertPopup.create { commits = { stack[#stack].options.oid } }
end,
["<enter>"] = function()
local stack = self.buffer.ui:get_component_stack_under_cursor()
Expand Down
2 changes: 1 addition & 1 deletion lua/neogit/buffers/reflog_view/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ function M:open()
end,
["_"] = function()
local stack = self.buffer.ui:get_component_stack_under_cursor()
RevertPopup.create(stack[#stack].options.oid)
RevertPopup.create { commits = { stack[#stack].options.oid } }
end,
["<enter>"] = function()
local stack = self.buffer.ui:get_component_stack_under_cursor()
Expand Down
3 changes: 1 addition & 2 deletions lua/neogit/popups/revert/actions.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
local a = require("plenary.async")
local status = require("neogit.status")
local git = require("neogit.lib.git")
local CommitSelectViewBuffer = require("neogit.buffers.commit_select_view")

Expand Down Expand Up @@ -28,7 +27,7 @@ function M.commits(popup)

git.revert.commits(commits, popup:get_arguments())
a.util.scheduler()
status.refresh(true, "revert_commits")
require("neogit.status").refresh(true, "revert_commits")
end

return M
4 changes: 2 additions & 2 deletions lua/neogit/popups/revert/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ local popup = require("neogit.lib.popup")

local M = {}

function M.create(commits)
function M.create(env)
-- TODO: enabled = true needs to check if incompatible switch is toggled in internal state, and not apply.
-- if you enable 'no edit', and revert, next time you load the popup both will be enabled
--
Expand All @@ -19,7 +19,7 @@ function M.create(commits)
:switch("E", "no-edit", "Don't edit commit messages", { incompatible = { "edit" } })
:action("_", "Revert commit", actions.commits) -- TODO: Support multiple commits
:action("v", "Revert changes")
:env({ commits = commits or {} })
:env({ commits = env.commits or {} })
:build()

p:show()
Expand Down
2 changes: 1 addition & 1 deletion lua/neogit/status.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1131,7 +1131,7 @@ local cmd_func_map = function()
end,
["RevertPopup"] = function()
local line = M.status_buffer:get_current_line()
require("neogit.popups.revert").create { line[1]:match("^(%x%x%x%x%x%x%x+)") }
require("neogit.popups.revert").create { commits = { line[1]:match("^(%x%x%x%x%x%x%x+)") } }
end,
["BranchPopup"] = require("neogit.popups.branch").create,
["FetchPopup"] = require("neogit.popups.fetch").create,
Expand Down