diff --git a/pkg/gui/controllers/local_commits_controller.go b/pkg/gui/controllers/local_commits_controller.go index d5e6265bd..306a7173a 100644 --- a/pkg/gui/controllers/local_commits_controller.go +++ b/pkg/gui/controllers/local_commits_controller.go @@ -1420,6 +1420,10 @@ func (self *LocalCommitsController) midRebaseCommandEnabled(selectedCommits []*m // Ensures that if we are mid-rebase, we're only selecting commits that can be moved func (self *LocalCommitsController) midRebaseMoveCommandEnabled(selectedCommits []*models.Commit, startIdx int, endIdx int) *types.DisabledReason { if !self.isRebasing() { + if lo.SomeBy(selectedCommits, func(c *models.Commit) bool { return c.IsMerge() }) { + return &types.DisabledReason{Text: self.c.Tr.CannotMoveMergeCommit} + } + return nil } diff --git a/pkg/i18n/english.go b/pkg/i18n/english.go index 675d6fcab..0d2af423f 100644 --- a/pkg/i18n/english.go +++ b/pkg/i18n/english.go @@ -160,6 +160,7 @@ type TranslationSet struct { MoveDownCommit string MoveUpCommit string CannotMoveAnyFurther string + CannotMoveMergeCommit string EditCommit string EditCommitTooltip string AmendCommitTooltip string @@ -1153,6 +1154,7 @@ func EnglishTranslationSet() *TranslationSet { MoveDownCommit: "Move commit down one", MoveUpCommit: "Move commit up one", CannotMoveAnyFurther: "Cannot move any further", + CannotMoveMergeCommit: "Cannot move a merge commit", EditCommit: "Edit (start interactive rebase)", EditCommitTooltip: "Edit the selected commit. Use this to start an interactive rebase from the selected commit. When already mid-rebase, this will mark the selected commit for editing, which means that upon continuing the rebase, the rebase will pause at the selected commit to allow you to make changes.", AmendCommitTooltip: "Amend commit with staged changes. If the selected commit is the HEAD commit, this will perform `git commit --amend`. Otherwise the commit will be amended via a rebase.",