mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-07-31 14:24:25 +03:00
Disallow cherry-picking update-ref todos
This commit is contained in:
@ -86,6 +86,7 @@ func (self *BasicCommitsController) GetKeybindings(opts types.KeybindingsOpts) [
|
|||||||
{
|
{
|
||||||
Key: opts.GetKey(opts.Config.Commits.CherryPickCopy),
|
Key: opts.GetKey(opts.Config.Commits.CherryPickCopy),
|
||||||
Handler: self.withItem(self.copyRange),
|
Handler: self.withItem(self.copyRange),
|
||||||
|
GetDisabledReason: self.require(self.itemRangeSelected(self.canCopyCommits)),
|
||||||
Description: self.c.Tr.CherryPickCopy,
|
Description: self.c.Tr.CherryPickCopy,
|
||||||
Tooltip: utils.ResolvePlaceholderString(self.c.Tr.CherryPickCopyTooltip,
|
Tooltip: utils.ResolvePlaceholderString(self.c.Tr.CherryPickCopyTooltip,
|
||||||
map[string]string{
|
map[string]string{
|
||||||
@ -292,6 +293,16 @@ func (self *BasicCommitsController) copyRange(*models.Commit) error {
|
|||||||
return self.c.Helpers().CherryPick.CopyRange(self.context.GetCommits(), self.context)
|
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 {
|
func (self *BasicCommitsController) handleOldCherryPickKey() error {
|
||||||
msg := utils.ResolvePlaceholderString(self.c.Tr.OldCherryPickKeyWarning,
|
msg := utils.ResolvePlaceholderString(self.c.Tr.OldCherryPickKeyWarning,
|
||||||
map[string]string{
|
map[string]string{
|
||||||
|
@ -302,6 +302,7 @@ type TranslationSet struct {
|
|||||||
PasteCommits string
|
PasteCommits string
|
||||||
SureCherryPick string
|
SureCherryPick string
|
||||||
CherryPick string
|
CherryPick string
|
||||||
|
CannotCherryPickNonCommit string
|
||||||
Donate string
|
Donate string
|
||||||
AskQuestion string
|
AskQuestion string
|
||||||
PrevLine string
|
PrevLine string
|
||||||
@ -1242,6 +1243,7 @@ func EnglishTranslationSet() TranslationSet {
|
|||||||
PasteCommits: "Paste (cherry-pick)",
|
PasteCommits: "Paste (cherry-pick)",
|
||||||
SureCherryPick: "Are you sure you want to cherry-pick the copied commits onto this branch?",
|
SureCherryPick: "Are you sure you want to cherry-pick the copied commits onto this branch?",
|
||||||
CherryPick: "Cherry-pick",
|
CherryPick: "Cherry-pick",
|
||||||
|
CannotCherryPickNonCommit: "Cannot cherry-pick this kind of todo item",
|
||||||
Donate: "Donate",
|
Donate: "Donate",
|
||||||
AskQuestion: "Ask Question",
|
AskQuestion: "Ask Question",
|
||||||
PrevLine: "Select previous line",
|
PrevLine: "Select previous line",
|
||||||
|
Reference in New Issue
Block a user