Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
changchaishi committed Jan 11, 2025
1 parent 53e2e33 commit 6e105e4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 9 deletions.
2 changes: 2 additions & 0 deletions models/git/branch.go
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,7 @@ type FindRecentlyPushedNewBranchesOptions struct {
}

type RecentlyPushedNewBranch struct {
BranchRepo *repo_model.Repository
BranchName string
BranchDisplayName string
BranchLink string
Expand Down Expand Up @@ -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)),
Expand Down
10 changes: 1 addition & 9 deletions routers/web/repo/view_home.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
Expand Down

0 comments on commit 6e105e4

Please sign in to comment.