summaryrefslogtreecommitdiffstats
path: root/pkg/gui
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/gui')
-rw-r--r--pkg/gui/branches_panel.go10
-rw-r--r--pkg/gui/dummies.go2
-rw-r--r--pkg/gui/gui.go11
-rw-r--r--pkg/gui/recent_repos_panel.go2
4 files changed, 12 insertions, 13 deletions
diff --git a/pkg/gui/branches_panel.go b/pkg/gui/branches_panel.go
index 7b712b2ba..8dff14ac1 100644
--- a/pkg/gui/branches_panel.go
+++ b/pkg/gui/branches_panel.go
@@ -61,10 +61,12 @@ func (gui *Gui) refreshBranches() {
}
}
- builder, err := commands.NewBranchListBuilder(gui.Log, gui.GitCommand, reflogCommits)
- if err != nil {
- _ = gui.surfaceError(err)
- }
+ builder := commands.NewBranchListBuilder(
+ gui.Common,
+ gui.GitCommand.GetRawBranches,
+ gui.GitCommand.CurrentBranchName,
+ reflogCommits,
+ )
gui.State.Branches = builder.Build()
if err := gui.postRefreshUpdate(gui.State.Contexts.Branches); err != nil {
diff --git a/pkg/gui/dummies.go b/pkg/gui/dummies.go
index 3c993836a..92a9c4d25 100644
--- a/pkg/gui/dummies.go
+++ b/pkg/gui/dummies.go
@@ -18,6 +18,6 @@ func NewDummyUpdater() *updates.Updater {
func NewDummyGui() *Gui {
newAppConfig := config.NewDummyAppConfig()
- dummyGui, _ := NewGui(utils.NewDummyLog(), commands.NewDummyGitCommand(), oscommands.NewDummyOSCommand(), i18n.NewTranslationSet(utils.NewDummyLog(), newAppConfig.GetUserConfig().Gui.Language), newAppConfig, NewDummyUpdater(), "", false)
+ dummyGui, _ := NewGui(utils.NewDummyCommon(), commands.NewDummyGitCommand(), oscommands.NewDummyOSCommand(), newAppConfig, NewDummyUpdater(), "", false)
return dummyGui
}
diff --git a/pkg/gui/gui.go b/pkg/gui/gui.go
index 39d2a9763..259bfb411 100644
--- a/pkg/gui/gui.go
+++ b/pkg/gui/gui.go
@@ -14,6 +14,7 @@ import (
"github.com/jesseduffield/lazygit/pkg/commands"
"github.com/jesseduffield/lazygit/pkg/commands/models"
"github.com/jesseduffield/lazygit/pkg/commands/oscommands"
+ "github.com/jesseduffield/lazygit/pkg/common"
"github.com/jesseduffield/lazygit/pkg/config"
"github.com/jesseduffield/lazygit/pkg/gui/filetree"
"github.com/jesseduffield/lazygit/pkg/gui/lbl"
@@ -25,12 +26,10 @@ import (
"github.com/jesseduffield/lazygit/pkg/gui/presentation/graph"
"github.com/jesseduffield/lazygit/pkg/gui/style"
"github.com/jesseduffield/lazygit/pkg/gui/types"
- "github.com/jesseduffield/lazygit/pkg/i18n"
"github.com/jesseduffield/lazygit/pkg/tasks"
"github.com/jesseduffield/lazygit/pkg/theme"
"github.com/jesseduffield/lazygit/pkg/updates"
"github.com/jesseduffield/lazygit/pkg/utils"
- "github.com/sirupsen/logrus"
"gopkg.in/ozeidan/fuzzy-patricia.v3/patricia"
)
@@ -67,8 +66,8 @@ type Repo string
// Gui wraps the gocui Gui object which handles rendering and events
type Gui struct {
+ *common.Common
g *gocui.Gui
- Log *logrus.Entry
GitCommand *commands.GitCommand
OSCommand *oscommands.OSCommand
@@ -79,7 +78,6 @@ type Gui struct {
// gui state when returning from a subrepo
RepoStateMap map[Repo]*guiState
Config config.AppConfigurer
- Tr *i18n.TranslationSet
Updater *updates.Updater
statusManager *statusManager
credentials credentials
@@ -431,13 +429,12 @@ func (gui *Gui) resetState(filterPath string, reuseState bool) {
// for now the split view will always be on
// NewGui builds a new gui handler
-func NewGui(log *logrus.Entry, gitCommand *commands.GitCommand, oSCommand *oscommands.OSCommand, tr *i18n.TranslationSet, config config.AppConfigurer, updater *updates.Updater, filterPath string, showRecentRepos bool) (*Gui, error) {
+func NewGui(cmn *common.Common, gitCommand *commands.GitCommand, oSCommand *oscommands.OSCommand, config config.AppConfigurer, updater *updates.Updater, filterPath string, showRecentRepos bool) (*Gui, error) {
gui := &Gui{
- Log: log,
+ Common: cmn,
GitCommand: gitCommand,
OSCommand: oSCommand,
Config: config,
- Tr: tr,
Updater: updater,
statusManager: &statusManager{},
viewBufferManagerMap: map[string]*tasks.ViewBufferManager{},
diff --git a/pkg/gui/recent_repos_panel.go b/pkg/gui/recent_repos_panel.go
index ae5d35948..2019af461 100644
--- a/pkg/gui/recent_repos_panel.go
+++ b/pkg/gui/recent_repos_panel.go
@@ -73,7 +73,7 @@ func (gui *Gui) dispatchSwitchToRepo(path string, reuse bool) error {
return err
}
- newGitCommand, err := commands.NewGitCommand(gui.Log, gui.OSCommand, gui.Tr, gui.Config, git_config.NewStdCachedGitConfig(gui.Log))
+ newGitCommand, err := commands.NewGitCommand(gui.Common, gui.OSCommand, gui.Config, git_config.NewStdCachedGitConfig(gui.Log))
if err != nil {
return err
}