mirror of
				https://github.com/go-gitea/gitea
				synced 2025-11-04 05:18:25 +00:00 
			
		
		
		
	fix: deal with empty repo
This commit is contained in:
		@@ -13,6 +13,7 @@ import (
 | 
				
			|||||||
	"code.gitea.io/gitea/modules/base"
 | 
						"code.gitea.io/gitea/modules/base"
 | 
				
			||||||
	"code.gitea.io/gitea/modules/context"
 | 
						"code.gitea.io/gitea/modules/context"
 | 
				
			||||||
	"code.gitea.io/gitea/modules/convert"
 | 
						"code.gitea.io/gitea/modules/convert"
 | 
				
			||||||
 | 
						"code.gitea.io/gitea/modules/git"
 | 
				
			||||||
	"code.gitea.io/gitea/modules/setting"
 | 
						"code.gitea.io/gitea/modules/setting"
 | 
				
			||||||
	"code.gitea.io/gitea/modules/util"
 | 
						"code.gitea.io/gitea/modules/util"
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
@@ -46,6 +47,11 @@ func List(ctx *context.Context) {
 | 
				
			|||||||
	ctx.Data["Title"] = ctx.Tr("repo.actions")
 | 
						ctx.Data["Title"] = ctx.Tr("repo.actions")
 | 
				
			||||||
	ctx.Data["PageIsActions"] = true
 | 
						ctx.Data["PageIsActions"] = true
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						var workflows git.Entries
 | 
				
			||||||
 | 
						if empty, err := ctx.Repo.GitRepo.IsEmpty(); err != nil {
 | 
				
			||||||
 | 
							ctx.Error(http.StatusInternalServerError, err.Error())
 | 
				
			||||||
 | 
							return
 | 
				
			||||||
 | 
						} else if !empty {
 | 
				
			||||||
		defaultBranch, err := ctx.Repo.GitRepo.GetDefaultBranch()
 | 
							defaultBranch, err := ctx.Repo.GitRepo.GetDefaultBranch()
 | 
				
			||||||
		if err != nil {
 | 
							if err != nil {
 | 
				
			||||||
			ctx.Error(http.StatusInternalServerError, err.Error())
 | 
								ctx.Error(http.StatusInternalServerError, err.Error())
 | 
				
			||||||
@@ -56,12 +62,12 @@ func List(ctx *context.Context) {
 | 
				
			|||||||
			ctx.Error(http.StatusInternalServerError, err.Error())
 | 
								ctx.Error(http.StatusInternalServerError, err.Error())
 | 
				
			||||||
			return
 | 
								return
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
							workflows, err = actions.ListWorkflows(commit)
 | 
				
			||||||
	workflows, err := actions.ListWorkflows(commit)
 | 
					 | 
				
			||||||
		if err != nil {
 | 
							if err != nil {
 | 
				
			||||||
			ctx.Error(http.StatusInternalServerError, err.Error())
 | 
								ctx.Error(http.StatusInternalServerError, err.Error())
 | 
				
			||||||
			return
 | 
								return
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	ctx.Data["workflows"] = workflows
 | 
						ctx.Data["workflows"] = workflows
 | 
				
			||||||
	ctx.Data["RepoLink"] = ctx.Repo.Repository.HTMLURL()
 | 
						ctx.Data["RepoLink"] = ctx.Repo.Repository.HTMLURL()
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user