From 6e105e4582153e2ae732ff8501fa3804af66d694 Mon Sep 17 00:00:00 2001 From: iknowright Date: Sat, 11 Jan 2025 16:03:59 +0800 Subject: [PATCH] fix --- models/git/branch.go | 2 ++ routers/web/repo/view_home.go | 10 +--------- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/models/git/branch.go b/models/git/branch.go index eb27a55592cee..a264f555d9dd4 100644 --- a/models/git/branch.go +++ b/models/git/branch.go @@ -440,6 +440,7 @@ type FindRecentlyPushedNewBranchesOptions struct { } type RecentlyPushedNewBranch struct { + BranchRepo *repo_model.Repository BranchName string BranchDisplayName string BranchLink string @@ -541,6 +542,7 @@ func FindRecentlyPushedNewBranches(ctx context.Context, doer *user_model.User, o branchDisplayName = fmt.Sprintf("%s:%s", branch.Repo.FullName(), branchDisplayName) } newBranches = append(newBranches, &RecentlyPushedNewBranch{ + BranchRepo: branch.Repo, BranchDisplayName: branchDisplayName, BranchName: branch.Name, BranchLink: fmt.Sprintf("%s/src/branch/%s", branch.Repo.Link(), util.PathEscapeSegments(branch.Name)), diff --git a/routers/web/repo/view_home.go b/routers/web/repo/view_home.go index 109384c417775..cc4ea1dca8385 100644 --- a/routers/web/repo/view_home.go +++ b/routers/web/repo/view_home.go @@ -221,24 +221,16 @@ func prepareRecentlyPushedNewBranches(ctx *context.Context) { log.Error("FindRecentlyPushedNewBranches failed: %v", err) } - log.Info("Branches %v", branches) - for _, branch := range branches { - log.Info("Info %v %v %v %v", opts.Repo, opts.BaseRepo, branch.BranchName, opts.BaseRepo.DefaultBranch) - - divergingInfo, err := repo_service.GetBranchDivergingInfo(ctx, opts.Repo, opts.BaseRepo, branch.BranchName, opts.BaseRepo.DefaultBranch) + divergingInfo, err := repo_service.GetBranchDivergingInfo(ctx, branch.BranchRepo, opts.BaseRepo, branch.BranchName, opts.BaseRepo.DefaultBranch) if err != nil { continue } - log.Info("divergingInfo %v", divergingInfo) // Base is the pushed branch (for fork branch or local pushed branch perspective) if divergingInfo.BaseIsNewer || divergingInfo.CommitsAhead > 0 { finalBranches = append(finalBranches, branch) } } - - log.Info("FinalBranches %v", finalBranches) - ctx.Data["RecentlyPushedNewBranches"] = finalBranches } }