1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-07-30 03:23:08 +03:00

Show menu instead of prompt when there are conflicts in a rebase or merge

This solves the issue that previously you could too easily abort a rebase
accidentally by hitting escape.
This commit is contained in:
Stefan Haller
2023-05-31 18:29:01 +02:00
parent c70c8e84f8
commit 16dceb813b
11 changed files with 131 additions and 21 deletions

View File

@ -138,15 +138,26 @@ func (self *MergeAndRebaseHelper) CheckMergeOrRebase(result error) error {
// assume in this case that we're already done
return nil
} else if isMergeConflictErr(result.Error()) {
return self.c.Confirm(types.ConfirmOpts{
Title: self.c.Tr.FoundConflictsTitle,
Prompt: self.c.Tr.FoundConflicts,
HandleConfirm: func() error {
return self.c.PushContext(self.c.Contexts().Files)
},
HandleClose: func() error {
return self.genericMergeCommand(REBASE_OPTION_ABORT)
mode := self.workingTreeStateNoun()
return self.c.Menu(types.CreateMenuOptions{
Title: self.c.Tr.FoundConflictsTitle,
Items: []*types.MenuItem{
{
Label: self.c.Tr.ViewConflictsMenuItem,
OnPress: func() error {
return self.c.PushContext(self.c.Contexts().Files)
},
Key: 'v',
},
{
Label: fmt.Sprintf(self.c.Tr.AbortMenuItem, mode),
OnPress: func() error {
return self.genericMergeCommand(REBASE_OPTION_ABORT)
},
Key: 'a',
},
},
HideCancel: true,
})
} else {
return self.c.ErrorMsg(result.Error())