1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-05-27 23:08:02 +02:00

Factor out redundant statement

This commit is contained in:
nullishamy 2022-08-01 19:39:39 +01:00
parent b9b2f58bc8
commit 69718fb557
No known key found for this signature in database
GPG Key ID: 5BAB63DCC2BF4F58

View File

@ -228,26 +228,25 @@ func (app *App) setupRepo() (bool, error) {
return false, err return false, err
} }
if isBare { fmt.Print(app.Tr.BareRepo)
fmt.Print(app.Tr.BareRepo)
response, _ := bufio.NewReader(os.Stdin).ReadString('\n')
shouldOpenRecent := strings.Trim(response, " \r\n") == "y"
if shouldOpenRecent { response, _ := bufio.NewReader(os.Stdin).ReadString('\n')
for _, repoDir := range app.Config.GetAppState().RecentRepos { shouldOpenRecent := strings.Trim(response, " \r\n") == "y"
if isRepo, _ := isDirectoryAGitRepository(repoDir); isRepo {
if err := os.Chdir(repoDir); err == nil { if shouldOpenRecent {
return true, nil for _, repoDir := range app.Config.GetAppState().RecentRepos {
} if isRepo, _ := isDirectoryAGitRepository(repoDir); isRepo {
if err := os.Chdir(repoDir); err == nil {
return true, nil
} }
} }
fmt.Println(app.Tr.NoRecentRepositories)
os.Exit(1)
} }
os.Exit(0) fmt.Println(app.Tr.NoRecentRepositories)
os.Exit(1)
} }
os.Exit(0)
} }
return false, nil return false, nil