Skip to content

Commit 2b27dda

Browse files
committed
Fix rebasing onto upstream when the upstream is not on a remote.
1 parent 97a612a commit 2b27dda

File tree

1 file changed

+6
-11
lines changed

1 file changed

+6
-11
lines changed

lua/neogit/popups/rebase/actions.lua

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -31,19 +31,14 @@ function M.onto_pushRemote(popup)
3131
end
3232

3333
function M.onto_upstream(popup)
34-
local upstream
35-
if git.repo.state.upstream.ref then
36-
upstream = string.format("refs/remotes/%s", git.repo.state.upstream.ref)
37-
else
38-
local target = FuzzyFinderBuffer.new(git.refs.list_remote_branches()):open_async()
39-
if not target then
40-
return
41-
end
42-
43-
upstream = string.format("refs/remotes/%s", target)
34+
local upstream = git.branch.upstream(git.branch.current())
35+
if not upstream then
36+
upstream = FuzzyFinderBuffer.new(git.refs.list_branches()):open_async()
4437
end
4538

46-
git.rebase.onto_branch(upstream, popup:get_arguments())
39+
if upstream then
40+
git.rebase.onto_branch(upstream, popup:get_arguments())
41+
end
4742
end
4843

4944
function M.onto_elsewhere(popup)

0 commit comments

Comments
 (0)