From ae44e3f06844f5b033152b72b1ee8f64026e2e5d Mon Sep 17 00:00:00 2001 From: Jason Song Date: Thu, 29 Feb 2024 15:53:55 +0800 Subject: [PATCH] Revert "feat: check branch commit" This reverts commit baf7515fcdfd2006f4c43fadb6560ca85f203816. --- routers/web/repo/view.go | 30 ------------------------------ 1 file changed, 30 deletions(-) diff --git a/routers/web/repo/view.go b/routers/web/repo/view.go index dafd1710d27e7..e89739e2fb6d1 100644 --- a/routers/web/repo/view.go +++ b/routers/web/repo/view.go @@ -768,7 +768,6 @@ func checkCitationFile(ctx *context.Context, entry *git.TreeEntry) { } } - // Home render repository home page func Home(ctx *context.Context) { if setting.Other.EnableFeed { @@ -1007,8 +1006,6 @@ func renderHomeCode(ctx *context.Context) { return } - checkOutdatedBranch(ctx) - checkCitationFile(ctx, entry) if ctx.Written() { return @@ -1075,31 +1072,6 @@ func renderHomeCode(ctx *context.Context) { ctx.HTML(http.StatusOK, tplRepoHome) } -func checkOutdatedBranch(ctx *context.Context) { - // get the head commit of the branch since ctx.Repo.CommitID is not always the head commit of `ctx.Repo.BranchName` - commit, err := ctx.Repo.GitRepo.GetBranchCommit(ctx.Repo.BranchName) - if err != nil { - log.Error("GetBranchCommitID: %v", err) - // Don't return an error page, as it can be rechecked the next time the user opens the page. - return - } - - - dbBranch, err := git_model.GetBranch(ctx, ctx.Repo.Repository.ID, ctx.Repo.BranchName) - if err != nil { - log.Error("GetBranch: %v", err) - // Don't return an error page, as it can be rechecked the next time the user opens the page. - return - } - - if commit.ID.String() != dbBranch.CommitID && - time.Since(commit.) - { - - } -} - - // RenderUserCards render a page show users according the input template func RenderUserCards(ctx *context.Context, total int, getter func(opts db.ListOptions) ([]*user_model.User, error), tpl base.TplName) { page := ctx.FormInt("page") @@ -1175,5 +1147,3 @@ func Forks(ctx *context.Context) { ctx.HTML(http.StatusOK, tplForks) } - -