aboutsummaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorwxiaoguang <wxiaoguang@gmail.com>2025-02-24 10:11:29 +0800
committerGitHub <noreply@github.com>2025-02-24 02:11:29 +0000
commit56a0a9c750b4cd48ca44a22ff0c860b9d035c950 (patch)
tree479279c6b6a591f46d5c454d2637ac8e004385d0 /services
parent8ae46d9684b93392885b3dd31a3185f53e046300 (diff)
downloadgitea-56a0a9c750b4cd48ca44a22ff0c860b9d035c950.tar.gz
gitea-56a0a9c750b4cd48ca44a22ff0c860b9d035c950.zip
Fix git empty check and HEAD request (#33690)
Diffstat (limited to 'services')
-rw-r--r--services/context/api.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/services/context/api.go b/services/context/api.go
index 230c3456d1..c163de036c 100644
--- a/services/context/api.go
+++ b/services/context/api.go
@@ -291,6 +291,11 @@ func RepoRefForAPI(next http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {
ctx := GetAPIContext(req)
+ if ctx.Repo.Repository.IsEmpty {
+ ctx.APIErrorNotFound("repository is empty")
+ return
+ }
+
if ctx.Repo.GitRepo == nil {
ctx.APIErrorInternal(fmt.Errorf("no open git repo"))
return