all repos

mugit @ e2d3a9c

🐮 git server that your cow will love
2 files changed, 5 insertions(+), 13 deletions(-)
refactor: if repo is empty so last commit is empty too
Author: Oleksandr Smirnov olexsmir@gmail.com
Committed at: 2026-02-11 01:32:34 +0200
Change ID: stvoqynwwxqxmlnqqzlmtvlmrnxlqult
Parent: 9c82bda
M internal/git/repo.go

@@ -125,7 +125,7 @@ }

func (g *Repo) LastCommit() (*Commit, error) { if g.IsEmpty() { - return nil, ErrEmptyRepo + return &Commit{}, nil } c, err := g.r.CommitObject(g.h)
M internal/handlers/repo.go

@@ -403,10 +403,7 @@ name := dir.Name()

normalizedName := getNormalizedName(name) repo, err := h.openPublicRepo(normalizedName, "") if err != nil { - if errors.Is(err, errPrivateRepo) { - continue - } - errs = append(errs, err) + // if it's not git repo, just ignore it continue }

@@ -416,21 +413,16 @@ errs = append(errs, err)

continue } - var lastCommitTime time.Time lastCommit, err := repo.LastCommit() if err != nil { - if !errors.Is(err, git.ErrEmptyRepo) { - errs = append(errs, err) - continue - } - } else { - lastCommitTime = lastCommit.Committed + errs = append(errs, err) + continue } repos = append(repos, repoList{ Name: normalizedName, Desc: desc, - LastCommit: lastCommitTime, + LastCommit: lastCommit.Committed, }) }