1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-06-27 00:51:18 +02:00

Only show private repo popup when opening repo for first time

This commit is contained in:
mjarkk
2018-12-06 22:05:16 +01:00
parent 6d0fa8bc29
commit ced81e11f0
3 changed files with 24 additions and 4 deletions

View File

@ -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 {