show more commits at repo index if readme is missing
1 file changed, 14 insertions(+), 2 deletions(-)
changed files
M routes/routes.go → routes/routes.go
@@ -19,6 +19,11 @@ "github.com/savsgio/atreugo/v11" "github.com/valyala/fasthttp" ) +const ( + RepoIndexCommitCountReadme = 3 + RepoIndexCommitCountNoReadme = 10 +) + type deps struct { c *config.Config projects []string@@ -87,8 +92,15 @@ if err != nil { return err } - if len(commits) >= 3 { - commits = commits[:3] + var baseComparison int + if readmeContent == "" { + baseComparison = RepoIndexCommitCountNoReadme + } else { + baseComparison = RepoIndexCommitCountReadme + } + + if len(commits) >= baseComparison { + commits = commits[:baseComparison] } pageData := templates.PageData{