Fix some bugs in repo garden in repositories with few commits

This commit is contained in:
Alex Hicks 2020-09-25 17:51:59 -04:00
parent f17d9672f5
commit 57cdfee835
2 changed files with 9 additions and 1 deletions

View file

@ -189,6 +189,14 @@ func gardenRun(opts *GardenOptions) error {
player := &Player{0, 0, utils.Bold("@"), geo, 0}
garden := plantGarden(commits, geo)
if len(garden) < geo.Height {
geo.Height = len(garden)
}
if geo.Height > 0 && len(garden[0]) < geo.Width {
geo.Width = len(garden[0])
} else if len(garden) == 0 {
geo.Width = 0
}
clear(opts.IO)
drawGarden(out, garden, player)

View file

@ -53,7 +53,7 @@ func getCommits(client *http.Client, repo ghrepo.Interface, maxCommits int) ([]*
})
}
link := resp.Header["Link"]
if !strings.Contains(link[0], "last") {
if len(link) == 0 || !strings.Contains(link[0], "last") {
paginating = false
}
page++