diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2022-01-30 20:03:08 +1100 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2022-03-17 19:13:40 +1100 |
commit | 0a8cff6ab68dc92b98136c4ebe5c6bc7f8f1b3c7 (patch) | |
tree | a68b6ffa7a886d73346f6305c76db0ffe54cbe7b /pkg/gui/gui.go | |
parent | e2f5fe101621c0162791d6ea312ef8093616f59c (diff) |
some more refactoring
Diffstat (limited to 'pkg/gui/gui.go')
-rw-r--r-- | pkg/gui/gui.go | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/pkg/gui/gui.go b/pkg/gui/gui.go index 93b9a2862..490ffca53 100644 --- a/pkg/gui/gui.go +++ b/pkg/gui/gui.go @@ -74,6 +74,8 @@ type Helpers struct { files *FilesHelper workingTree *WorkingTreeHelper tags *controllers.TagsHelper + rebase *controllers.RebaseHelper + cherryPick *controllers.CherryPickHelper } type Repo string @@ -373,7 +375,7 @@ const ( type Modes struct { Filtering filtering.Filtering - CherryPicking cherrypicking.CherryPicking + CherryPicking *cherrypicking.CherryPicking Diffing diffing.Diffing } @@ -556,10 +558,12 @@ func (gui *Gui) setControllers() { getState := func() *GuiRepoState { return gui.State } getContexts := func() context.ContextTree { return gui.State.Contexts } // TODO: have a getGit function too + rebaseHelper := controllers.NewRebaseHelper(controllerCommon, getContexts, gui.git, gui.takeOverMergeConflictScrolling) gui.helpers = &Helpers{ refs: NewRefsHelper( controllerCommon, gui.git, + getContexts, getState, ), bisect: controllers.NewBisectHelper(controllerCommon, gui.git), @@ -567,6 +571,14 @@ func (gui *Gui) setControllers() { files: NewFilesHelper(controllerCommon, gui.git, osCommand), workingTree: NewWorkingTreeHelper(func() []*models.File { return gui.State.Files }), tags: controllers.NewTagsHelper(controllerCommon, gui.git), + rebase: rebaseHelper, + cherryPick: controllers.NewCherryPickHelper( + controllerCommon, + gui.git, + getContexts, + func() *cherrypicking.CherryPicking { return gui.State.Modes.CherryPicking }, + rebaseHelper, + ), } syncController := controllers.NewSyncController( @@ -575,7 +587,7 @@ func (gui *Gui) setControllers() { gui.getCheckedOutBranch, gui.helpers.suggestions, gui.getSuggestedRemote, - gui.checkMergeOrRebase, + gui.helpers.rebase.CheckMergeOrRebase, ) gui.Controllers = Controllers{ @@ -624,10 +636,12 @@ func (gui *Gui) setControllers() { gui.git, gui.helpers.tags, gui.helpers.refs, + gui.helpers.cherryPick, + gui.helpers.rebase, gui.getSelectedLocalCommit, func() []*models.Commit { return gui.State.Commits }, func() int { return gui.State.Panels.Commits.SelectedLineIdx }, - gui.checkMergeOrRebase, + gui.helpers.rebase.CheckMergeOrRebase, syncController.HandlePull, gui.getHostingServiceMgr, gui.SwitchToCommitFilesContext, |