File tree Expand file tree Collapse file tree 1 file changed +19
-2
lines changed Expand file tree Collapse file tree 1 file changed +19
-2
lines changed Original file line number Diff line number Diff line change @@ -840,8 +840,25 @@ func renderCode(ctx *context.Context) {
840
840
ctx .Data ["PageIsViewCode" ] = true
841
841
842
842
if ctx .Repo .Repository .IsEmpty {
843
- ctx .HTML (http .StatusOK , tplRepoEMPTY )
844
- return
843
+ reallyEmpty , err := ctx .Repo .GitRepo .IsEmpty ()
844
+ if err != nil {
845
+ ctx .ServerError ("GitRepo.IsEmpty" , err )
846
+ return
847
+ }
848
+ if reallyEmpty {
849
+ ctx .HTML (http .StatusOK , tplRepoEMPTY )
850
+ return
851
+ }
852
+ // the repo is not really empty, so we should update the modal in database
853
+ ctx .Repo .Repository .IsEmpty = false
854
+ if err = repo_model .UpdateRepositoryCols (ctx .Repo .Repository , "is_empty" ); err != nil {
855
+ ctx .ServerError ("UpdateRepositoryCols" , err )
856
+ return
857
+ }
858
+ if err = models .UpdateRepoSize (db .DefaultContext , ctx .Repo .Repository ); err != nil {
859
+ ctx .ServerError ("UpdateRepoSize" , err )
860
+ return
861
+ }
845
862
}
846
863
847
864
title := ctx .Repo .Repository .Owner .Name + "/" + ctx .Repo .Repository .Name
You can’t perform that action at this time.
0 commit comments