summaryrefslogtreecommitdiffstats
path: root/services/repository
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2020-01-25 10:48:22 +0800
committerGitHub <noreply@github.com>2020-01-25 10:48:22 +0800
commitf2d12f7b034e32d0e7cc7b60e7ad015af122db3f (patch)
tree5009bac317f4dbed07c459aa5361583a4f3fc2b7 /services/repository
parentee26f042c421d90cbd3f852427de8b98f1cc71a7 (diff)
downloadgitea-f2d12f7b034e32d0e7cc7b60e7ad015af122db3f.tar.gz
gitea-f2d12f7b034e32d0e7cc7b60e7ad015af122db3f.zip
Fix pull view when head repository or head branch missed and close related pull requests when delete head repository or head branch (#9927)
* fix pull view when head repository or head branch missed and close related pull requests when delete branch * fix pull view broken when head repository deleted * close pull requests when head repositories deleted * Add tests for broken pull request head repository or branch * fix typo * ignore special error when close pull request Co-authored-by: Lauris BH <lauris@nix.lv>
Diffstat (limited to 'services/repository')
-rw-r--r--services/repository/repository.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/services/repository/repository.go b/services/repository/repository.go
index eea8b352b4..f50b98b640 100644
--- a/services/repository/repository.go
+++ b/services/repository/repository.go
@@ -11,6 +11,7 @@ import (
"code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/notification"
repo_module "code.gitea.io/gitea/modules/repository"
+ pull_service "code.gitea.io/gitea/services/pull"
)
// CreateRepository creates a repository for the user/organization.
@@ -49,6 +50,10 @@ func ForkRepository(doer, u *models.User, oldRepo *models.Repository, name, desc
// DeleteRepository deletes a repository for a user or organization.
func DeleteRepository(doer *models.User, repo *models.Repository) error {
+ if err := pull_service.CloseRepoBranchesPulls(doer, repo); err != nil {
+ log.Error("CloseRepoBranchesPulls failed: %v", err)
+ }
+
if err := models.DeleteRepository(doer, repo.OwnerID, repo.ID); err != nil {
return err
}