diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2019-11-17 14:28:38 +1100 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2019-11-21 22:07:14 +1100 |
commit | b42202ea1c82d93d828fec38ddfdc073c041dec9 (patch) | |
tree | c495aaf3ff26b1f12110a66381918cbde2f9f056 /pkg/gui/branches_panel.go | |
parent | 8347dcd67149e329d3c23c7453a59b12e2d5533d (diff) |
better fast forward
Diffstat (limited to 'pkg/gui/branches_panel.go')
-rw-r--r-- | pkg/gui/branches_panel.go | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/pkg/gui/branches_panel.go b/pkg/gui/branches_panel.go index c3fd37f26..28f16562a 100644 --- a/pkg/gui/branches_panel.go +++ b/pkg/gui/branches_panel.go @@ -342,17 +342,27 @@ func (gui *Gui) handleFastForward(g *gocui.Gui, v *gocui.View) error { if branch.Pushables != "0" { return gui.createErrorPanel(gui.g, gui.Tr.SLocalize("FwdCommitsToPush")) } - upstream := "origin" // hardcoding for now + + upstream, err := gui.GitCommand.GetUpstreamForBranch(branch.Name) + if err != nil { + return gui.createErrorPanel(gui.g, err.Error()) + } + + split := strings.Split(upstream, "/") + remoteName := split[0] + remoteBranchName := strings.Join(split[1:], "/") + message := gui.Tr.TemplateLocalize( "Fetching", Teml{ - "from": fmt.Sprintf("%s/%s", upstream, branch.Name), + "from": fmt.Sprintf("%s/%s", remoteName, remoteBranchName), "to": branch.Name, }, ) go func() { _ = gui.createLoaderPanel(gui.g, v, message) - if err := gui.GitCommand.FastForward(branch.Name); err != nil { + + if err := gui.GitCommand.FastForward(branch.Name, remoteName, remoteBranchName); err != nil { _ = gui.createErrorPanel(gui.g, err.Error()) } else { _ = gui.closeConfirmationPrompt(gui.g, true) |