]> source.dussan.org Git - gitea.git/commitdiff
fix wrong system notice when repository is empty (#9010)
authorLunny Xiao <xiaolunwen@gmail.com>
Fri, 15 Nov 2019 10:53:20 +0000 (18:53 +0800)
committerzeripath <art27@cantab.net>
Fri, 15 Nov 2019 10:53:20 +0000 (10:53 +0000)
routers/repo/middlewares.go

index 6ff09cb845deee961d6f578d68a4a6ca252a9581..e513189f6bfcf1aa33663a0a003f3c4a54950255 100644 (file)
@@ -10,6 +10,11 @@ import (
 
 // SetEditorconfigIfExists set editor config as render variable
 func SetEditorconfigIfExists(ctx *context.Context) {
+       if ctx.Repo.Repository.IsEmpty {
+               ctx.Data["Editorconfig"] = nil
+               return
+       }
+
        ec, err := ctx.Repo.GetEditorconfig()
 
        if err != nil && !git.IsErrNotExist(err) {