summaryrefslogtreecommitdiffstats
path: root/models
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 /models
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 'models')
-rw-r--r--models/pull.go6
1 files changed, 5 insertions, 1 deletions
diff --git a/models/pull.go b/models/pull.go
index 42d93bd541..1895030f75 100644
--- a/models/pull.go
+++ b/models/pull.go
@@ -67,7 +67,11 @@ type PullRequest struct {
// MustHeadUserName returns the HeadRepo's username if failed return blank
func (pr *PullRequest) MustHeadUserName() string {
if err := pr.LoadHeadRepo(); err != nil {
- log.Error("LoadHeadRepo: %v", err)
+ if !IsErrRepoNotExist(err) {
+ log.Error("LoadHeadRepo: %v", err)
+ } else {
+ log.Warn("LoadHeadRepo %d but repository does not exist: %v", pr.HeadRepoID, err)
+ }
return ""
}
return pr.HeadRepo.OwnerName