mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-06-15 00:15:32 +02:00
Disabled paste when there are no copied commits
This commit is contained in:
@ -110,9 +110,10 @@ func (self *LocalCommitsController) GetKeybindings(opts types.KeybindingsOpts) [
|
||||
Description: self.c.Tr.MoveUpCommit,
|
||||
},
|
||||
{
|
||||
Key: opts.GetKey(opts.Config.Commits.PasteCommits),
|
||||
Handler: self.paste,
|
||||
Description: self.c.Tr.PasteCommits,
|
||||
Key: opts.GetKey(opts.Config.Commits.PasteCommits),
|
||||
Handler: self.paste,
|
||||
GetDisabledReason: self.getDisabledReasonForPaste,
|
||||
Description: self.c.Tr.PasteCommits,
|
||||
},
|
||||
{
|
||||
Key: opts.GetKey(opts.Config.Commits.MarkCommitAsBaseForRebase),
|
||||
@ -1001,6 +1002,14 @@ func (self *LocalCommitsController) paste() error {
|
||||
return self.c.Helpers().CherryPick.Paste()
|
||||
}
|
||||
|
||||
func (self *LocalCommitsController) getDisabledReasonForPaste() string {
|
||||
if !self.c.Helpers().CherryPick.CanPaste() {
|
||||
return self.c.Tr.NoCopiedCommits
|
||||
}
|
||||
|
||||
return ""
|
||||
}
|
||||
|
||||
func (self *LocalCommitsController) markAsBaseCommit(commit *models.Commit) error {
|
||||
if commit.Sha == self.c.Modes().MarkedBaseCommit.GetSha() {
|
||||
// Reset when invoking it again on the marked commit
|
||||
|
Reference in New Issue
Block a user