1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2024-11-26 09:00:57 +02:00

fix golangci errors

This commit is contained in:
Jesse Duffield 2019-02-16 21:30:29 +11:00
parent 88ba6efdd5
commit cb372d469f
3 changed files with 13 additions and 12 deletions

View File

@ -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

View File

@ -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" {

View File

@ -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