all repos — elgit @ c81702be8dcb7d741031c9058921953a46206750

fork of legit: web frontend for git, written in go

show more commits at repo index if readme is missing

Alan Pearce
commit

c81702be8dcb7d741031c9058921953a46206750

parent

1d7ef8da697824d1bcfb2f5bfaa517fcb47a0ce1

1 file changed, 14 insertions(+), 2 deletions(-)

changed files
M routes/routes.goroutes/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{