summaryrefslogtreecommitdiffstats
path: root/pkg/gui/recent_repos_panel.go
diff options
context:
space:
mode:
authorJesse Duffield <jessedduffield@gmail.com>2022-01-16 14:46:53 +1100
committerJesse Duffield <jessedduffield@gmail.com>2022-03-17 19:13:40 +1100
commit1dd7307fde033dae5fececac15810a99e26c3d91 (patch)
tree4e851c9e3229a6fe3b4191f6311d05d7a9142960 /pkg/gui/recent_repos_panel.go
parenta90b6efded49abcfa2516db794d7875b0396f558 (diff)
start moving commit panel handlers into controller
more and more move rebase commit refreshing into existing abstraction and more and more WIP and more handling clicks properly fix merge conflicts update cheatsheet lots more preparation to start moving things into controllers WIP better typing expand on remotes controller moving more code into controllers
Diffstat (limited to 'pkg/gui/recent_repos_panel.go')
-rw-r--r--pkg/gui/recent_repos_panel.go27
1 files changed, 16 insertions, 11 deletions
diff --git a/pkg/gui/recent_repos_panel.go b/pkg/gui/recent_repos_panel.go
index ec6a1ffc7..428faa9c9 100644
--- a/pkg/gui/recent_repos_panel.go
+++ b/pkg/gui/recent_repos_panel.go
@@ -13,7 +13,7 @@ import (
)
func (gui *Gui) handleCreateRecentReposMenu() error {
- recentRepoPaths := gui.Config.GetAppState().RecentRepos
+ recentRepoPaths := gui.c.GetAppState().RecentRepos
reposCount := utils.Min(len(recentRepoPaths), 20)
// we won't show the current repo hence the -1
@@ -34,11 +34,11 @@ func (gui *Gui) handleCreateRecentReposMenu() error {
}
}
- return gui.PopupHandler.Menu(popup.CreateMenuOptions{Title: gui.Tr.RecentRepos, Items: menuItems})
+ return gui.c.Menu(popup.CreateMenuOptions{Title: gui.c.Tr.RecentRepos, Items: menuItems})
}
func (gui *Gui) handleShowAllBranchLogs() error {
- cmdObj := gui.Git.Branch.AllBranchesLogCmdObj()
+ cmdObj := gui.git.Branch.AllBranchesLogCmdObj()
task := NewRunPtyTask(cmdObj.GetCmd())
return gui.refreshMainViews(refreshMainOpts{
@@ -58,7 +58,7 @@ func (gui *Gui) dispatchSwitchToRepo(path string, reuse bool) error {
if err := os.Chdir(path); err != nil {
if os.IsNotExist(err) {
- return gui.PopupHandler.ErrorMsg(gui.Tr.ErrRepositoryMovedOrDeleted)
+ return gui.c.ErrorMsg(gui.c.Tr.ErrRepositoryMovedOrDeleted)
}
return err
}
@@ -71,11 +71,16 @@ func (gui *Gui) dispatchSwitchToRepo(path string, reuse bool) error {
return err
}
- newGitCommand, err := commands.NewGitCommand(gui.Common, gui.OSCommand, git_config.NewStdCachedGitConfig(gui.Log))
+ newGitCommand, err := commands.NewGitCommand(
+ gui.Common,
+ gui.OSCommand,
+ git_config.NewStdCachedGitConfig(gui.Log),
+ gui.Mutexes.FetchMutex,
+ )
if err != nil {
return err
}
- gui.Git = newGitCommand
+ gui.git = newGitCommand
// these two mutexes are used by our background goroutines (triggered via `gui.goEvery`. We don't want to
// switch to a repo while one of these goroutines is in the process of updating something
@@ -97,23 +102,23 @@ func (gui *Gui) dispatchSwitchToRepo(path string, reuse bool) error {
// updateRecentRepoList registers the fact that we opened lazygit in this repo,
// so that we can open the same repo via the 'recent repos' menu
func (gui *Gui) updateRecentRepoList() error {
- if gui.Git.Status.IsBareRepo() {
+ if gui.git.Status.IsBareRepo() {
// we could totally do this but it would require storing both the git-dir and the
// worktree in our recent repos list, which is a change that would need to be
// backwards compatible
- gui.Log.Info("Not appending bare repo to recent repo list")
+ gui.c.Log.Info("Not appending bare repo to recent repo list")
return nil
}
- recentRepos := gui.Config.GetAppState().RecentRepos
+ recentRepos := gui.c.GetAppState().RecentRepos
currentRepo, err := os.Getwd()
if err != nil {
return err
}
known, recentRepos := newRecentReposList(recentRepos, currentRepo)
gui.IsNewRepo = known
- gui.Config.GetAppState().RecentRepos = recentRepos
- return gui.Config.SaveAppState()
+ gui.c.GetAppState().RecentRepos = recentRepos
+ return gui.c.SaveAppState()
}
// newRecentReposList returns a new repo list with a new entry but only when it doesn't exist yet