all repos

mugit @ e6fe8220d1822f3b98bb22da5ef766ed759309d0

🐮 git server that your cow will love
2 files changed, 11 insertions(+), 1 deletions(-)
fix: 404 on file not found
Author: Oleksandr Smirnov olexsmir@gmail.com
Committed at: 2026-02-06 20:55:59 +0200
Change ID: zwvsnvxorvrtxnxmvzsoqvxuskovkwvy
Parent: ebd4bbe
M internal/git/repo.go

@@ -15,7 +15,10 @@ )

// Thanks https://git.icyphox.sh/legit/blob/master/git/git.go -var ErrEmptyRepo = errors.New("repository has no commits") +var ( + ErrEmptyRepo = errors.New("repository has no commits") + ErrFileNotFound = errors.New("file not found") +) type Repo struct { path string

@@ -138,6 +141,9 @@ }

file, err := tree.File(path) if err != nil { + if errors.Is(err, object.ErrFileNotFound) { + return "", ErrFileNotFound + } return "", err }
M internal/handlers/repo.go

@@ -181,6 +181,10 @@ }

contents, err := repo.FileContent(treePath) if err != nil { + if errors.Is(err, git.ErrFileNotFound) { + h.write404(w, err) + return + } h.write500(w, err) return }