diff options
Diffstat (limited to 'routers/web/repo/branch.go')
-rw-r--r-- | routers/web/repo/branch.go | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/routers/web/repo/branch.go b/routers/web/repo/branch.go index f0282a71b8..8e3383848f 100644 --- a/routers/web/repo/branch.go +++ b/routers/web/repo/branch.go @@ -57,7 +57,25 @@ func Branches(ctx *context.Context) { return } + commitIDs := []string{defaultBranch.DBBranch.CommitID} + for _, branch := range branches { + commitIDs = append(commitIDs, branch.DBBranch.CommitID) + } + + commitStatuses, err := git_model.GetLatestCommitStatusForRepoCommitIDs(ctx, ctx.Repo.Repository.ID, commitIDs) + if err != nil { + ctx.ServerError("LoadBranches", err) + return + } + + commitStatus := make(map[string]*git_model.CommitStatus) + for commitID, cs := range commitStatuses { + commitStatus[commitID] = git_model.CalcCommitStatus(cs) + } + ctx.Data["Branches"] = branches + ctx.Data["CommitStatus"] = commitStatus + ctx.Data["CommitStatuses"] = commitStatuses ctx.Data["DefaultBranchBranch"] = defaultBranch pager := context.NewPagination(int(branchesCount), pageSize, page, 5) pager.SetDefaultParams(ctx) |