From 3ae71bb23f1f85601930841f2bb43b5f51e4d65e Mon Sep 17 00:00:00 2001 From: wxiaoguang Date: Tue, 14 Jan 2025 10:04:33 +0800 Subject: [PATCH] fix --- routers/web/repo/view_home.go | 3 ++- routers/web/web.go | 3 +-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/routers/web/repo/view_home.go b/routers/web/repo/view_home.go index 169c1a277f2fd..9e16a53c90baf 100644 --- a/routers/web/repo/view_home.go +++ b/routers/web/repo/view_home.go @@ -241,6 +241,7 @@ func handleRepoEmptyOrBroken(ctx *context.Context) { showEmpty := true if ctx.Repo.GitRepo != nil { reallyEmpty, err := ctx.Repo.GitRepo.IsEmpty() + defaultBranchCommit, _ := ctx.Repo.GitRepo.GetBranchCommit(ctx.Repo.Repository.DefaultBranch) if err != nil { showEmpty = true // the repo is broken updateContextRepoEmptyAndStatus(ctx, true, repo_model.RepositoryBroken) @@ -249,7 +250,7 @@ func handleRepoEmptyOrBroken(ctx *context.Context) { } else if reallyEmpty { showEmpty = true // the repo is really empty updateContextRepoEmptyAndStatus(ctx, true, repo_model.RepositoryReady) - } else if ctx.Repo.Commit == nil { + } else if defaultBranchCommit == nil { showEmpty = true // it is not really empty, but there is no branch // at the moment, other repo units like "actions" are not able to handle such case, // so we just mark the repo as empty to prevent from displaying these units. diff --git a/routers/web/web.go b/routers/web/web.go index a243a79f8a17d..3c6e0862afb5e 100644 --- a/routers/web/web.go +++ b/routers/web/web.go @@ -1335,8 +1335,7 @@ func registerRoutes(m *web.Router) { m.Get(".atom", feedEnabled, repo.TagsListFeedAtom) }, ctxDataSet("EnableFeed", setting.Other.EnableFeed), repo.MustBeNotEmpty, context.RepoRefByType(context.RepoRefTag, context.RepoRefByTypeOptions{IgnoreNotExistErr: true})) - m.Post("/tags/delete", repo.DeleteTag, reqSignIn, - repo.MustBeNotEmpty, context.RepoMustNotBeArchived(), reqRepoCodeWriter, context.RepoRef()) + m.Post("/tags/delete", reqSignIn, repo.MustBeNotEmpty, context.RepoMustNotBeArchived(), reqRepoCodeWriter, repo.DeleteTag) }, optSignIn, context.RepoAssignment, reqRepoCodeReader) // end "/{username}/{reponame}": repo tags