From bc6616d5117b7a660b58bc67ab74cb7adc64cb10 Mon Sep 17 00:00:00 2001 From: Stefan Haller Date: Sat, 10 Feb 2024 11:27:18 +0100 Subject: Disallow cherry-picking merge commits --- pkg/gui/controllers/basic_commits_controller.go | 4 ++++ pkg/i18n/english.go | 2 ++ 2 files changed, 6 insertions(+) diff --git a/pkg/gui/controllers/basic_commits_controller.go b/pkg/gui/controllers/basic_commits_controller.go index d2e494991..a589e3828 100644 --- a/pkg/gui/controllers/basic_commits_controller.go +++ b/pkg/gui/controllers/basic_commits_controller.go @@ -298,6 +298,10 @@ func (self *BasicCommitsController) canCopyCommits(selectedCommits []*models.Com if commit.Sha == "" { return &types.DisabledReason{Text: self.c.Tr.CannotCherryPickNonCommit, ShowErrorInPanel: true} } + + if commit.IsMerge() { + return &types.DisabledReason{Text: self.c.Tr.CannotCherryPickMergeCommit, ShowErrorInPanel: true} + } } return nil diff --git a/pkg/i18n/english.go b/pkg/i18n/english.go index 8f54e4bd6..048f0e6c4 100644 --- a/pkg/i18n/english.go +++ b/pkg/i18n/english.go @@ -303,6 +303,7 @@ type TranslationSet struct { SureCherryPick string CherryPick string CannotCherryPickNonCommit string + CannotCherryPickMergeCommit string Donate string AskQuestion string PrevLine string @@ -1244,6 +1245,7 @@ func EnglishTranslationSet() TranslationSet { SureCherryPick: "Are you sure you want to cherry-pick the copied commits onto this branch?", CherryPick: "Cherry-pick", CannotCherryPickNonCommit: "Cannot cherry-pick this kind of todo item", + CannotCherryPickMergeCommit: "Cherry-picking merge commits is not supported", Donate: "Donate", AskQuestion: "Ask Question", PrevLine: "Select previous line", -- cgit v1.2.3