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
9 changes: 9 additions & 0 deletions lua/neogit/lib/git/cli.lua
Original file line number Diff line number Diff line change
Expand Up @@ -483,6 +483,15 @@ local configurations = {
},
},

["rev-list"] = config {
flags = {
parents = "--parents",
},
options = {
max_count = "--max-count",
},
},

["rev-parse"] = config {
flags = {
verify = "--verify",
Expand Down
10 changes: 9 additions & 1 deletion lua/neogit/popups/rebase/actions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,15 @@ function M.interactively(popup)
end

if commit then
git.rebase.rebase_interactive(commit, popup:get_arguments())
local args = popup:get_arguments()
local parent_commit = git.cli["rev-list"].max_count(1).parents.args(commit).call().stdout[1]
if commit ~= parent_commit then
commit = vim.split(parent_commit, " ")[2]
else
table.insert(args, "--root")
end

git.rebase.rebase_interactive(commit, args)
end
end

Expand Down