1
1
mirror of https://github.com/go-gitea/gitea synced 2025-11-16 11:18:12 +00:00

We don't need to duplicated operation when delete branch

This commit is contained in:
Lunny Xiao
2024-12-05 21:58:52 -08:00
parent 16bd6510ac
commit fd7c953677
4 changed files with 32 additions and 25 deletions

View File

@@ -165,6 +165,23 @@ func (prs PullRequestList) getRepositoryIDs() []int64 {
return repoIDs.Values()
}
func (prs PullRequestList) SetBaseRepo(baseRepo *repo_model.Repository) {
for _, pr := range prs {
if pr.BaseRepo == nil {
pr.BaseRepo = baseRepo
}
}
}
func (prs PullRequestList) SetHeadRepo(headRepo *repo_model.Repository) {
for _, pr := range prs {
if pr.HeadRepo == nil {
pr.HeadRepo = headRepo
pr.isHeadRepoLoaded = true
}
}
}
func (prs PullRequestList) LoadRepositories(ctx context.Context) error {
repoIDs := prs.getRepositoryIDs()
reposMap := make(map[int64]*repo_model.Repository, len(repoIDs))