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

fix up some things with the patch handling stuff

This commit is contained in:
Jesse Duffield 2020-03-28 12:52:45 +11:00
parent 0c0231c3e8
commit 517b7d0283
5 changed files with 17 additions and 7 deletions

View File

@ -661,7 +661,10 @@ func (c *GitCommand) GenericMerge(commandType string, command string) error {
),
)
if err != nil {
return err
if !strings.Contains(err.Error(), "no rebase in progress") {
return err
}
c.Log.Warn(err)
}
// sometimes we need to do a sequence of things in a rebase but the user needs to

View File

@ -351,11 +351,13 @@ func (gui *Gui) handleFastForward(g *gocui.Gui, v *gocui.View) error {
if gui.State.Panels.Branches.SelectedLine == 0 {
if err := gui.GitCommand.PullWithoutPasswordCheck("--ff-only"); err != nil {
_ = gui.surfaceError(err)
return
}
_ = gui.refreshSidePanels(refreshOptions{mode: ASYNC})
} else {
if err := gui.GitCommand.FastForward(branch.Name, remoteName, remoteBranchName); err != nil {
_ = gui.surfaceError(err)
return
}
_ = gui.refreshSidePanels(refreshOptions{mode: ASYNC, scope: []int{BRANCHES}})
}

View File

@ -209,7 +209,9 @@ func (gui *Gui) enterCommitFile(selectedLineIdx int) error {
return gui.createConfirmationPanel(gui.g, gui.getCommitFilesView(), false, gui.Tr.SLocalize("DiscardPatch"), gui.Tr.SLocalize("DiscardPatchConfirm"), func(g *gocui.Gui, v *gocui.View) error {
gui.GitCommand.PatchManager.Reset()
return enterTheFile(selectedLineIdx)
}, nil)
}, func(g *gocui.Gui, v *gocui.View) error {
return gui.switchFocus(gui.g, nil, gui.getCommitFilesView())
})
}
return enterTheFile(selectedLineIdx)

View File

@ -127,11 +127,7 @@ func (gui *Gui) createPopupPanel(g *gocui.Gui, currentView *gocui.View, title, p
}
gui.renderString(g, "confirmation", prompt)
if err := gui.setKeyBindings(g, handleConfirm, handleClose, returnFocusOnClose); err != nil {
return err
}
return gui.refreshSidePanels(refreshOptions{})
return gui.setKeyBindings(g, handleConfirm, handleClose, returnFocusOnClose)
})
return nil
}
@ -183,6 +179,10 @@ func (gui *Gui) createSpecificErrorPanel(message string, nextView *gocui.View, w
colorFunction := color.New(color.FgRed).SprintFunc()
coloredMessage := colorFunction(strings.TrimSpace(message))
if err := gui.refreshSidePanels(refreshOptions{mode: ASYNC}); err != nil {
return err
}
return gui.createConfirmationPanel(gui.g, nextView, true, gui.Tr.SLocalize("Error"), coloredMessage, nil, nil)
}

View File

@ -74,6 +74,9 @@ func (gui *Gui) handleGenericMergeCommandResult(result error) error {
return gui.genericMergeCommand("skip")
} else if strings.Contains(result.Error(), "The previous cherry-pick is now empty") {
return gui.genericMergeCommand("continue")
} else if strings.Contains(result.Error(), "No rebase in progress?") {
// assume in this case that we're already done
return nil
} else if strings.Contains(result.Error(), "When you have resolved this problem") || strings.Contains(result.Error(), "fix conflicts") || strings.Contains(result.Error(), "Resolve all conflicts manually") {
return gui.createConfirmationPanel(gui.g, gui.getFilesView(), true, gui.Tr.SLocalize("FoundConflictsTitle"), gui.Tr.SLocalize("FoundConflicts"),
func(g *gocui.Gui, v *gocui.View) error {