Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to revert hunk #1612

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Change name from hunk to item
Reads a bit better

Change-Id: I2c5aaa5b68a140de49bd38c10b2dca4b10e15efe
  • Loading branch information
Philip Johansson authored and kjughx committed Dec 24, 2024
commit 5a3d8f5fd7c789ed168a36ead801e6dfdf209fd3
2 changes: 1 addition & 1 deletion lua/neogit/buffers/commit_view/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ function M:open(kind)
end),
[popups.mapping_for("RemotePopup")] = popups.open("remote"),
[popups.mapping_for("RevertPopup")] = popups.open("revert", function(p)
p { commits = { self.commit_info.oid }, hunk = self.buffer.ui:get_hunk_or_filename_under_cursor() }
p { commits = { self.commit_info.oid }, item = self.buffer.ui:get_hunk_or_filename_under_cursor() }
end),
[popups.mapping_for("ResetPopup")] = popups.open("reset", function(p)
p { commit = self.commit_info.oid }
Expand Down
6 changes: 3 additions & 3 deletions lua/neogit/popups/revert/actions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,11 @@ function M.changes(popup)
end

function M.hunk(popup)
local hunk = popup.state.env.hunk
if hunk == nil then
local item = popup.state.env.item
if item == nil then
return
end
git.revert.hunk(hunk.hunk, popup:get_arguments())
git.revert.hunk(item.hunk, popup:get_arguments())
end

function M.continue()
Expand Down