diff options
Diffstat (limited to 'pkg/gui/controllers/branches_controller.go')
-rw-r--r-- | pkg/gui/controllers/branches_controller.go | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/pkg/gui/controllers/branches_controller.go b/pkg/gui/controllers/branches_controller.go index 8b4a5d395..9f5ba7f05 100644 --- a/pkg/gui/controllers/branches_controller.go +++ b/pkg/gui/controllers/branches_controller.go @@ -111,10 +111,11 @@ func (self *BranchesController) GetKeybindings(opts types.KeybindingsOpts) []*ty { Key: opts.GetKey(opts.Config.Branches.MergeIntoCurrentBranch), Handler: opts.Guards.OutsideFilterMode(self.merge), - GetDisabledReason: self.require(self.singleItemSelected()), + GetDisabledReason: self.require(self.singleItemSelected(self.notMergingIntoYourself)), Description: self.c.Tr.Merge, Tooltip: self.c.Tr.MergeBranchTooltip, DisplayOnScreen: true, + OpensMenu: true, }, { Key: opts.GetKey(opts.Config.Branches.FastForward), @@ -826,3 +827,14 @@ func (self *BranchesController) branchIsReal(branch *models.Branch) *types.Disab return nil } + +func (self *BranchesController) notMergingIntoYourself(branch *models.Branch) *types.DisabledReason { + selectedBranchName := branch.Name + checkedOutBranch := self.c.Helpers().Refs.GetCheckedOutRef().Name + + if checkedOutBranch == selectedBranchName { + return &types.DisabledReason{Text: self.c.Tr.CantMergeBranchIntoItself} + } + + return nil +} |