1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-07-15 01:34:26 +02:00

Made gobot happy

This commit is contained in:
mjarkk
2018-12-10 14:21:00 +01:00
parent 76e9582739
commit e20d8366e1

View File

@ -15,7 +15,7 @@ type recentRepo struct {
} }
// GetDisplayStrings returns the path from a recent repo. // GetDisplayStrings returns the path from a recent repo.
func (r recentRepo) GetDisplayStrings() []string { func (r *recentRepo) GetDisplayStrings() []string {
yellow := color.New(color.FgMagenta) yellow := color.New(color.FgMagenta)
base := filepath.Base(r.path) base := filepath.Base(r.path)
path := yellow.Sprint(r.path) path := yellow.Sprint(r.path)
@ -26,14 +26,14 @@ func (gui *Gui) handleCreateRecentReposMenu(g *gocui.Gui, v *gocui.View) error {
recentRepoPaths := gui.Config.GetAppState().RecentRepos recentRepoPaths := gui.Config.GetAppState().RecentRepos
reposCount := utils.Min(len(recentRepoPaths), 20) reposCount := utils.Min(len(recentRepoPaths), 20)
// we won't show the current repo hence the -1 // we won't show the current repo hence the -1
recentRepos := make([]string, reposCount-1) recentRepos := make([]*recentRepo, reposCount-1)
for i, repo := range recentRepoPaths[1:reposCount] { for i, path := range recentRepoPaths[1:reposCount] {
recentRepos[i] = repo recentRepos[i] = &recentRepo{path: path}
} }
handleMenuPress := func(index int) error { handleMenuPress := func(index int) error {
repoPath := recentRepos[index] repo := recentRepos[index]
if err := os.Chdir(repoPath); err != nil { if err := os.Chdir(repo.path); err != nil {
return err return err
} }
newGitCommand, err := commands.NewGitCommand(gui.Log, gui.OSCommand, gui.Tr) newGitCommand, err := commands.NewGitCommand(gui.Log, gui.OSCommand, gui.Tr)