diff --git a/pkg/gui/gui.go b/pkg/gui/gui.go index dfaf48cf7..5b62236af 100644 --- a/pkg/gui/gui.go +++ b/pkg/gui/gui.go @@ -245,7 +245,9 @@ func (gui *Gui) onFocusLost(v *gocui.View) error { return nil } if v.Name() == "branches" { - gui.renderListPanel(gui.getBranchesView(), gui.State.Branches) + if err := gui.renderListPanel(gui.getBranchesView(), gui.State.Branches); err != nil { + return err + } } gui.Log.Info(v.Name() + " focus lost") return nil diff --git a/pkg/gui/merge_panel.go b/pkg/gui/merge_panel.go index fccfb3a59..efb6c5544 100644 --- a/pkg/gui/merge_panel.go +++ b/pkg/gui/merge_panel.go @@ -171,8 +171,7 @@ func (gui *Gui) handlePickHunk(g *gocui.Gui, v *gocui.View) error { return err } } - gui.refreshMergePanel() - return nil + return gui.refreshMergePanel() } func (gui *Gui) handlePickBothHunks(g *gocui.Gui, v *gocui.View) error { @@ -194,7 +193,6 @@ func (gui *Gui) refreshMergePanel() error { if cat == "" { return nil } - gui.Log.Info(cat) panelState.Conflicts, err = gui.findConflicts(cat) if err != nil { return err @@ -232,13 +230,10 @@ func (gui *Gui) scrollToConflict(g *gocui.Gui) error { } mergingView := gui.getMainView() conflict := panelState.Conflicts[panelState.ConflictIndex] - gui.Log.Info(utils.AsJson(conflict)) ox, _ := mergingView.Origin() _, height := mergingView.Size() conflictMiddle := (conflict.End + conflict.Start) / 2 newOriginY := int(math.Max(0, float64(conflictMiddle-(height/2)))) - gui.Log.Info(utils.AsJson("origin Y")) - gui.Log.Info(utils.AsJson(newOriginY)) gui.g.Update(func(g *gocui.Gui) error { return mergingView.SetOrigin(ox, newOriginY) }) @@ -257,7 +252,9 @@ func (gui *Gui) renderMergeOptions() error { func (gui *Gui) handleEscapeMerge(g *gocui.Gui, v *gocui.View) error { gui.State.Panels.Merging.EditHistory = stack.New() - gui.refreshFiles() + if err := gui.refreshFiles(); err != nil { + return err + } // it's possible this method won't be called from the merging view so we need to // ensure we only 'return' focus if we already have it if gui.g.CurrentView() == gui.getMainView() { @@ -268,8 +265,12 @@ func (gui *Gui) handleEscapeMerge(g *gocui.Gui, v *gocui.View) error { func (gui *Gui) handleCompleteMerge() error { filesView := gui.getFilesView() - gui.stageSelectedFile(gui.g) - gui.refreshFiles() + if err := gui.stageSelectedFile(gui.g); err != nil { + return err + } + if err := gui.refreshFiles(); err != nil { + return err + } // if we got conflicts after unstashing, we don't want to call any git // commands to continue rebasing/merging here if gui.State.WorkingTreeState == "normal" { diff --git a/pkg/gui/rebase_options_panel.go b/pkg/gui/rebase_options_panel.go index 11afbbeca..1c3c98518 100644 --- a/pkg/gui/rebase_options_panel.go +++ b/pkg/gui/rebase_options_panel.go @@ -52,7 +52,6 @@ func (gui *Gui) genericMergeCommand(command string) error { // we should end up with a command like 'git merge --continue' // it's impossible for a rebase to require a commit so we'll use a subprocess only if it's a merge - // TODO: find a way to make the commit automatic if status == "merging" && command != "abort" && gui.Config.GetUserConfig().GetBool("git.merging.manualCommit") { sub := gui.OSCommand.PrepareSubProcess("git", commandType, fmt.Sprintf("--%s", command)) if sub != nil { @@ -79,7 +78,6 @@ func (gui *Gui) handleGenericMergeCommandResult(result error) error { } else if strings.Contains(result.Error(), "No changes - did you forget to use") { return gui.genericMergeCommand("skip") } else if strings.Contains(result.Error(), "When you have resolved this problem") || strings.Contains(result.Error(), "fix conflicts") { - // TODO: generalise this title to support merging and rebasing return gui.createConfirmationPanel(gui.g, gui.getFilesView(), gui.Tr.SLocalize("FoundConflictsTitle"), gui.Tr.SLocalize("FoundConflicts"), func(g *gocui.Gui, v *gocui.View) error { return nil