X Tutup
Skip to content

Commit 57cdfee

Browse files
committed
Fix some bugs in repo garden in repositories with few commits
1 parent f17d967 commit 57cdfee

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

pkg/cmd/repo/garden/garden.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,14 @@ func gardenRun(opts *GardenOptions) error {
189189
player := &Player{0, 0, utils.Bold("@"), geo, 0}
190190

191191
garden := plantGarden(commits, geo)
192+
if len(garden) < geo.Height {
193+
geo.Height = len(garden)
194+
}
195+
if geo.Height > 0 && len(garden[0]) < geo.Width {
196+
geo.Width = len(garden[0])
197+
} else if len(garden) == 0 {
198+
geo.Width = 0
199+
}
192200
clear(opts.IO)
193201
drawGarden(out, garden, player)
194202

pkg/cmd/repo/garden/http.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ func getCommits(client *http.Client, repo ghrepo.Interface, maxCommits int) ([]*
5353
})
5454
}
5555
link := resp.Header["Link"]
56-
if !strings.Contains(link[0], "last") {
56+
if len(link) == 0 || !strings.Contains(link[0], "last") {
5757
paginating = false
5858
}
5959
page++

0 commit comments

Comments
 (0)
X Tutup