summaryrefslogtreecommitdiffstats
path: root/pkg/gui/branches_panel.go
diff options
context:
space:
mode:
authorJesse Duffield <jessedduffield@gmail.com>2022-01-30 11:01:32 +1100
committerJesse Duffield <jessedduffield@gmail.com>2022-03-17 19:13:40 +1100
commitb04038d08f3afb9210d43cfd4c9d95b073fd7a59 (patch)
tree9cd38f9e0ed115c8b5b9721a1cdcffd7288950d8 /pkg/gui/branches_panel.go
parent55b393c9292aa5277595c056b166d1efe305d02b (diff)
no need to invoke sync controller here
Diffstat (limited to 'pkg/gui/branches_panel.go')
-rw-r--r--pkg/gui/branches_panel.go27
1 files changed, 22 insertions, 5 deletions
diff --git a/pkg/gui/branches_panel.go b/pkg/gui/branches_panel.go
index 95a754030..e524ef9a2 100644
--- a/pkg/gui/branches_panel.go
+++ b/pkg/gui/branches_panel.go
@@ -306,12 +306,29 @@ func (gui *Gui) handleFastForward() error {
)
return gui.c.WithLoaderPanel(message, func() error {
- gui.c.LogAction(action)
- err := gui.git.Sync.FastForward(branch.Name, branch.UpstreamRemote, branch.UpstreamBranch)
- if err != nil {
- _ = gui.c.Error(err)
+ if gui.State.Panels.Branches.SelectedLineIdx == 0 {
+ gui.c.LogAction(action)
+
+ err := gui.git.Sync.Pull(
+ git_commands.PullOptions{
+ RemoteName: branch.UpstreamRemote,
+ BranchName: branch.Name,
+ FastForwardOnly: true,
+ },
+ )
+ if err != nil {
+ _ = gui.c.Error(err)
+ }
+
+ return gui.c.Refresh(types.RefreshOptions{Mode: types.ASYNC})
+ } else {
+ gui.c.LogAction(action)
+ err := gui.git.Sync.FastForward(branch.Name, branch.UpstreamRemote, branch.UpstreamBranch)
+ if err != nil {
+ _ = gui.c.Error(err)
+ }
+ _ = gui.c.Refresh(types.RefreshOptions{Mode: types.ASYNC, Scope: []types.RefreshableView{types.BRANCHES}})
}
- _ = gui.c.Refresh(types.RefreshOptions{Mode: types.ASYNC, Scope: []types.RefreshableView{types.BRANCHES}})
return nil
})