@@ -372,6 +372,8 @@ func AddTestPullRequestTask(opts TestPullRequestOptions) {
372372 // TODO: graceful: AddTestPullRequestTask needs to become a queue!
373373
374374 // GetUnmergedPullRequestsByHeadInfo() only return open and unmerged PR.
375+ // TODO: rename the "prs" to a new variable like "headBranchPRs" to distinguish from the "baseBranchPRs" below
376+ // The base repositories of headBranchPRs are different
375377 prs , err := issues_model .GetUnmergedPullRequestsByHeadInfo (ctx , opts .RepoID , opts .Branch )
376378 if err != nil {
377379 log .Error ("Find pull requests [head_repo_id: %d, head_branch: %s]: %v" , opts .RepoID , opts .Branch , err )
@@ -458,6 +460,8 @@ func AddTestPullRequestTask(opts TestPullRequestOptions) {
458460 }
459461
460462 log .Trace ("AddTestPullRequestTask [base_repo_id: %d, base_branch: %s]: finding pull requests" , opts .RepoID , opts .Branch )
463+ // TODO: rename the "prs" to a new variable like "baseBranchPRs" to distinguish from the "headBranchPRs" above
464+ // The base repositories of baseBranchPRs are the same one (opts.RepoID)
461465 prs , err = issues_model .GetUnmergedPullRequestsByBaseInfo (ctx , opts .RepoID , opts .Branch )
462466 if err != nil {
463467 log .Error ("Find pull requests [base_repo_id: %d, base_branch: %s]: %v" , opts .RepoID , opts .Branch , err )
@@ -469,7 +473,7 @@ func AddTestPullRequestTask(opts TestPullRequestOptions) {
469473 return
470474 }
471475 for _ , pr := range prs {
472- pr .BaseRepo = baseRepo // avoid loading again // FIXME: why only here does so but the code above doesn't do so
476+ pr .BaseRepo = baseRepo // avoid loading again
473477 divergence , err := GetDiverging (ctx , pr )
474478 if err != nil {
475479 if git_model .IsErrBranchNotExist (err ) && ! gitrepo .IsBranchExist (ctx , pr .HeadRepo , pr .HeadBranch ) {
0 commit comments