Skip to content

Commit 4eff692

Browse files
committed
When Deleting Repository only explicitly close PRs whose base is not this repository
Fix #14775 Signed-off-by: Andrew Thornton <[email protected]>
1 parent 3d8b5ad commit 4eff692

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

services/pull/pull.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -480,7 +480,7 @@ func CloseBranchPulls(doer *models.User, repoID int64, branch string) error {
480480
return nil
481481
}
482482

483-
// CloseRepoBranchesPulls close all pull requests which head branches are in the given repository
483+
// CloseRepoBranchesPulls close all pull requests which head branches are in the given repository, but whose base repo is not in the given repository
484484
func CloseRepoBranchesPulls(doer *models.User, repo *models.Repository) error {
485485
branches, _, err := git.GetBranchesByPath(repo.RepoPath(), 0, 0)
486486
if err != nil {
@@ -499,6 +499,9 @@ func CloseRepoBranchesPulls(doer *models.User, repo *models.Repository) error {
499499
}
500500

501501
for _, pr := range prs {
502+
if pr.BaseRepoID == repo.ID {
503+
continue
504+
}
502505
if err = issue_service.ChangeStatus(pr.Issue, doer, true); err != nil && !models.IsErrPullWasClosed(err) {
503506
errs = append(errs, err)
504507
}

0 commit comments

Comments
 (0)