Skip to content

Commit

Permalink
When Deleting Repository only explicitly close PRs whose base is not …
Browse files Browse the repository at this point in the history
…this repository

Fix #14775

Signed-off-by: Andrew Thornton <art27@cantab.net>
  • Loading branch information
zeripath committed Feb 27, 2021
1 parent 3d8b5ad commit 4eff692
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion services/pull/pull.go
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,7 @@ func CloseBranchPulls(doer *models.User, repoID int64, branch string) error {
return nil
}

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

for _, pr := range prs {
if pr.BaseRepoID == repo.ID {
continue
}
if err = issue_service.ChangeStatus(pr.Issue, doer, true); err != nil && !models.IsErrPullWasClosed(err) {
errs = append(errs, err)
}
Expand Down

0 comments on commit 4eff692

Please sign in to comment.