From 30707ac8834faff0d7f5ba40f318d88aede92e59 Mon Sep 17 00:00:00 2001 From: Seongmin Lee Date: Mon, 25 May 2026 21:16:13 +0900 Subject: [PATCH] knotmirror/xrpc: git.listLanguages: default to HEAD when ref is empty Signed-off-by: Seongmin Lee --- knotmirror/xrpc/git_list_languages.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/knotmirror/xrpc/git_list_languages.go b/knotmirror/xrpc/git_list_languages.go index 7313712e..c3dce79a 100644 --- a/knotmirror/xrpc/git_list_languages.go +++ b/knotmirror/xrpc/git_list_languages.go @@ -36,10 +36,14 @@ func (x *Xrpc) ListLanguages(w http.ResponseWriter, r *http.Request) { return } + if ref == "" { + ref = "HEAD" + } + commit, err := gitea.GetCommit(ctx, repoPath, ref) if err != nil { l.Error("failed to get commit", "err", err) - writeJson(w, http.StatusNotFound, atclient.ErrorBody{Name: "RefNotFound", Message: fmt.Sprintf("unknown git ref: %s", repo)}) + writeJson(w, http.StatusNotFound, atclient.ErrorBody{Name: "RefNotFound", Message: fmt.Sprintf("unknown git ref: %s", ref)}) return } -- 2.51.2