all repos

mugit @ b883855

🐮 git server that your cow will love
1 files changed, 8 insertions(+), 7 deletions(-)
fix: check if ref exists before archiving
Author: Oleksandr Smirnov olexsmir@gmail.com
Committed at: 2026-02-24 17:51:49 +0200
Change ID: kokmnqxprrxzzxktkozzvzksxrvpvxmu
Parent: 88da23a
M internal/handlers/git.go

@@ -32,7 +32,7 @@ }

} func (h *handlers) infoRefs(w http.ResponseWriter, r *http.Request) { - path, err := h.checkRepoPublicityAndGetPath(r.PathValue("name")) + path, err := h.checkRepoPublicityAndGetPath(r.PathValue("name"), "") if err != nil { h.write404(w, err) return

@@ -48,7 +48,7 @@ }

} func (h *handlers) uploadPack(w http.ResponseWriter, r *http.Request) { - path, err := h.checkRepoPublicityAndGetPath(r.PathValue("name")) + path, err := h.checkRepoPublicityAndGetPath(r.PathValue("name"), "") if err != nil { h.write404(w, err) return

@@ -65,9 +65,10 @@ }

} func (h *handlers) archiveHandler(w http.ResponseWriter, r *http.Request) { - ref := h.parseRef(r.PathValue("ref")) name := r.PathValue("name") - path, err := h.checkRepoPublicityAndGetPath(name) + ref := h.parseRef(r.PathValue("ref")) + + path, err := h.checkRepoPublicityAndGetPath(name, ref) if err != nil { h.write404(w, err) return

@@ -84,15 +85,15 @@ return

} } -func (h *handlers) checkRepoPublicityAndGetPath(name string) (string, error) { +func (h *handlers) checkRepoPublicityAndGetPath(name string, ref string) (string, error) { name = git.ResolveName(name) path, err := git.ResolvePath(h.c.Repo.Dir, name) if err != nil { return "", err } - if _, err := git.OpenPublic(path, ""); err != nil { - return "", err + if _, oerr := git.OpenPublic(path, ref); oerr != nil { + return "", oerr } return path, err