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
Authored at: 2026-02-11 00:44:14 +0200
Change ID: stvoqynwwxqxmlnqqzlmtvlmrnxlqult
Parent: 9c82bda
M internal/git/repo.go
路路路
        125
        125
         

      
        126
        126
         func (g *Repo) LastCommit() (*Commit, error) {

      
        127
        127
         	if g.IsEmpty() {

      
        128
        
        -		return nil, ErrEmptyRepo

      
        
        128
        +		return &Commit{}, nil

      
        129
        129
         	}

      
        130
        130
         

      
        131
        131
         	c, err := g.r.CommitObject(g.h)

      
M internal/handlers/repo.go
路路路
        403
        403
         		normalizedName := getNormalizedName(name)

      
        404
        404
         		repo, err := h.openPublicRepo(normalizedName, "")

      
        405
        405
         		if err != nil {

      
        406
        
        -			if errors.Is(err, errPrivateRepo) {

      
        407
        
        -				continue

      
        408
        
        -			}

      
        409
        
        -			errs = append(errs, err)

      
        
        406
        +			// if it's not git repo, just ignore it

      
        410
        407
         			continue

      
        411
        408
         		}

      
        412
        409
         

      路路路
        416
        413
         			continue

      
        417
        414
         		}

      
        418
        415
         

      
        419
        
        -		var lastCommitTime time.Time

      
        420
        416
         		lastCommit, err := repo.LastCommit()

      
        421
        417
         		if err != nil {

      
        422
        
        -			if !errors.Is(err, git.ErrEmptyRepo) {

      
        423
        
        -				errs = append(errs, err)

      
        424
        
        -				continue

      
        425
        
        -			}

      
        426
        
        -		} else {

      
        427
        
        -			lastCommitTime = lastCommit.Committed

      
        
        418
        +			errs = append(errs, err)

      
        
        419
        +			continue

      
        428
        420
         		}

      
        429
        421
         

      
        430
        422
         		repos = append(repos, repoList{

      
        431
        423
         			Name:       normalizedName,

      
        432
        424
         			Desc:       desc,

      
        433
        
        -			LastCommit: lastCommitTime,

      
        
        425
        +			LastCommit: lastCommit.Committed,

      
        434
        426
         		})

      
        435
        427
         	}

      
        436
        428