summaryrefslogtreecommitdiffstats
path: root/pkg/gui/sub_commits_panel.go
diff options
context:
space:
mode:
authorJesse Duffield <jessedduffield@gmail.com>2022-01-30 20:03:08 +1100
committerJesse Duffield <jessedduffield@gmail.com>2022-03-17 19:13:40 +1100
commit0a8cff6ab68dc92b98136c4ebe5c6bc7f8f1b3c7 (patch)
treea68b6ffa7a886d73346f6305c76db0ffe54cbe7b /pkg/gui/sub_commits_panel.go
parente2f5fe101621c0162791d6ea312ef8093616f59c (diff)
some more refactoring
Diffstat (limited to 'pkg/gui/sub_commits_panel.go')
-rw-r--r--pkg/gui/sub_commits_panel.go28
1 files changed, 28 insertions, 0 deletions
diff --git a/pkg/gui/sub_commits_panel.go b/pkg/gui/sub_commits_panel.go
index a6fae60c9..5d81d5a9c 100644
--- a/pkg/gui/sub_commits_panel.go
+++ b/pkg/gui/sub_commits_panel.go
@@ -102,3 +102,31 @@ func (gui *Gui) switchToSubCommitsContext(refName string) error {
return gui.c.PushContext(gui.State.Contexts.SubCommits)
}
+
+func (gui *Gui) handleNewBranchOffSubCommit() error {
+ commit := gui.getSelectedSubCommit()
+ if commit == nil {
+ return nil
+ }
+
+ return gui.helpers.refs.NewBranch(commit.RefName(), commit.Description(), "")
+}
+
+func (gui *Gui) handleCopySubCommit() error {
+ commit := gui.getSelectedSubCommit()
+ if commit == nil {
+ return nil
+ }
+
+ return gui.helpers.cherryPick.Copy(commit, gui.State.SubCommits, gui.State.Contexts.SubCommits)
+}
+
+func (gui *Gui) handleCopySubCommitRange() error {
+ // just doing this to ensure something is selected
+ commit := gui.getSelectedSubCommit()
+ if commit == nil {
+ return nil
+ }
+
+ return gui.helpers.cherryPick.CopyRange(gui.State.Contexts.SubCommits.GetPanelState().GetSelectedLineIdx(), gui.State.SubCommits, gui.State.Contexts.SubCommits)
+}