diff options
author | mjarkk <mkopenga@gmail.com> | 2018-12-06 22:05:16 +0100 |
---|---|---|
committer | mjarkk <mkopenga@gmail.com> | 2018-12-06 22:05:16 +0100 |
commit | ced81e11f048a954b707996d78487e3a6cabd569 (patch) | |
tree | dd159e14e73178b37bf5062f2f2e4b4e660a2173 /pkg/gui/recent_repos_panel.go | |
parent | 6d0fa8bc2926af9c17c7546c447613ae21ef19fc (diff) |
Only show private repo popup when opening repo for first time
Diffstat (limited to 'pkg/gui/recent_repos_panel.go')
-rw-r--r-- | pkg/gui/recent_repos_panel.go | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/pkg/gui/recent_repos_panel.go b/pkg/gui/recent_repos_panel.go index 98da6a9c2..2b7d05f0a 100644 --- a/pkg/gui/recent_repos_panel.go +++ b/pkg/gui/recent_repos_panel.go @@ -59,6 +59,24 @@ func (gui *Gui) updateRecentRepoList() error { return gui.Config.SaveAppState() } +// canShowIsPrivateRepo returns true if a private repo is never opend before in lazygit +func (gui *Gui) canShowIsPrivateRepo() bool { + repos := gui.Config.GetAppState().RecentPrivateRepos + currentRepo, err := os.Getwd() + for _, repo := range repos { + if currentRepo == repo { + return false + } + } + if err != nil { + return true + } + gui.Config.GetAppState().RecentPrivateRepos = newRecentReposList(repos, currentRepo) + _ = gui.Config.SaveAppState() + return true +} + +// newRecentReposList returns a new repo list with a new entry but only when it doesn't exist yet func newRecentReposList(recentRepos []string, currentRepo string) []string { newRepos := []string{currentRepo} for _, repo := range recentRepos { |