mirror of
https://github.com/jesseduffield/lazygit.git
synced 2024-11-28 09:08:41 +02:00
Disallow cherry-picking update-ref todos
This commit is contained in:
parent
dc40fb5267
commit
2c82b3f8dd
@ -84,9 +84,10 @@ func (self *BasicCommitsController) GetKeybindings(opts types.KeybindingsOpts) [
|
||||
DisplayOnScreen: true,
|
||||
},
|
||||
{
|
||||
Key: opts.GetKey(opts.Config.Commits.CherryPickCopy),
|
||||
Handler: self.withItem(self.copyRange),
|
||||
Description: self.c.Tr.CherryPickCopy,
|
||||
Key: opts.GetKey(opts.Config.Commits.CherryPickCopy),
|
||||
Handler: self.withItem(self.copyRange),
|
||||
GetDisabledReason: self.require(self.itemRangeSelected(self.canCopyCommits)),
|
||||
Description: self.c.Tr.CherryPickCopy,
|
||||
Tooltip: utils.ResolvePlaceholderString(self.c.Tr.CherryPickCopyTooltip,
|
||||
map[string]string{
|
||||
"paste": keybindings.Label(opts.Config.Commits.PasteCommits),
|
||||
@ -292,6 +293,16 @@ func (self *BasicCommitsController) copyRange(*models.Commit) error {
|
||||
return self.c.Helpers().CherryPick.CopyRange(self.context.GetCommits(), self.context)
|
||||
}
|
||||
|
||||
func (self *BasicCommitsController) canCopyCommits(selectedCommits []*models.Commit, startIdx int, endIdx int) *types.DisabledReason {
|
||||
for _, commit := range selectedCommits {
|
||||
if commit.Sha == "" {
|
||||
return &types.DisabledReason{Text: self.c.Tr.CannotCherryPickNonCommit, ShowErrorInPanel: true}
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (self *BasicCommitsController) handleOldCherryPickKey() error {
|
||||
msg := utils.ResolvePlaceholderString(self.c.Tr.OldCherryPickKeyWarning,
|
||||
map[string]string{
|
||||
|
@ -302,6 +302,7 @@ type TranslationSet struct {
|
||||
PasteCommits string
|
||||
SureCherryPick string
|
||||
CherryPick string
|
||||
CannotCherryPickNonCommit string
|
||||
Donate string
|
||||
AskQuestion string
|
||||
PrevLine string
|
||||
@ -1242,6 +1243,7 @@ func EnglishTranslationSet() TranslationSet {
|
||||
PasteCommits: "Paste (cherry-pick)",
|
||||
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",
|
||||
Donate: "Donate",
|
||||
AskQuestion: "Ask Question",
|
||||
PrevLine: "Select previous line",
|
||||
|
Loading…
Reference in New Issue
Block a user