diff options
author | zeripath <art27@cantab.net> | 2021-03-01 17:39:44 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-01 18:39:44 +0100 |
commit | 59fd641d1fb021e35aea7f9f4a1916cc11ef5c51 (patch) | |
tree | 8682cc3e5bd26597562a290455a088ab88ff4a22 /services/pull | |
parent | 85e6e07346fd408451d69f6ecc3d06c2b46bbb25 (diff) | |
download | gitea-59fd641d1fb021e35aea7f9f4a1916cc11ef5c51.tar.gz gitea-59fd641d1fb021e35aea7f9f4a1916cc11ef5c51.zip |
When Deleting Repository only explicitly close PRs whose base is not this repository (#14823)
When Deleting Repository only explicitly close PRs whose base is not this repository
Fix #14775
Signed-off-by: Andrew Thornton <art27@cantab.net>
Diffstat (limited to 'services/pull')
-rw-r--r-- | services/pull/pull.go | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/services/pull/pull.go b/services/pull/pull.go index 4f742f5a1a..cadb317472 100644 --- a/services/pull/pull.go +++ b/services/pull/pull.go @@ -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 only 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 { @@ -499,6 +499,11 @@ func CloseRepoBranchesPulls(doer *models.User, repo *models.Repository) error { } for _, pr := range prs { + // If the base repository for this pr is this repository there is no need to close it + // as it is going to be deleted anyway + if pr.BaseRepoID == repo.ID { + continue + } if err = issue_service.ChangeStatus(pr.Issue, doer, true); err != nil && !models.IsErrPullWasClosed(err) { errs = append(errs, err) } |