aboutsummaryrefslogtreecommitdiffstats
path: root/services/pull/temp_repo.go
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2020-03-03 06:31:55 +0800
committerGitHub <noreply@github.com>2020-03-02 22:31:55 +0000
commit5abe1c52de533b52725b1e584db9fea6fb1b39ab (patch)
tree1cd49bc1a609bb919c70d6bc30727c524c3e6105 /services/pull/temp_repo.go
parent22b750702408a39a524e011b729d0e0befb30e16 (diff)
downloadgitea-5abe1c52de533b52725b1e584db9fea6fb1b39ab.tar.gz
gitea-5abe1c52de533b52725b1e584db9fea6fb1b39ab.zip
Display pull request head branch even the branch deleted or repository deleted (#10413)
* Display pull request head branch even the branch deleted or repository deleted * Merge getHeadRepo/loadHeadRepo and getBaseRepo/loadBaseRepo on pull and fill repo when pr.Issue.Repo is available * retrieve sha from pull head when pull request branch deleted and fix tests * Fix test * Ensure MustHeadRepoName returns empty string if no head repo Co-authored-by: zeripath <art27@cantab.net>
Diffstat (limited to 'services/pull/temp_repo.go')
-rw-r--r--services/pull/temp_repo.go12
1 files changed, 6 insertions, 6 deletions
diff --git a/services/pull/temp_repo.go b/services/pull/temp_repo.go
index bb6ce2921e..ffac92ade5 100644
--- a/services/pull/temp_repo.go
+++ b/services/pull/temp_repo.go
@@ -17,17 +17,17 @@ import (
)
func createTemporaryRepo(pr *models.PullRequest) (string, error) {
- if err := pr.GetHeadRepo(); err != nil {
- log.Error("GetHeadRepo: %v", err)
- return "", fmt.Errorf("GetHeadRepo: %v", err)
+ if err := pr.LoadHeadRepo(); err != nil {
+ log.Error("LoadHeadRepo: %v", err)
+ return "", fmt.Errorf("LoadHeadRepo: %v", err)
} else if pr.HeadRepo == nil {
log.Error("Pr %d HeadRepo %d does not exist", pr.ID, pr.HeadRepoID)
return "", &models.ErrRepoNotExist{
ID: pr.HeadRepoID,
}
- } else if err := pr.GetBaseRepo(); err != nil {
- log.Error("GetBaseRepo: %v", err)
- return "", fmt.Errorf("GetBaseRepo: %v", err)
+ } else if err := pr.LoadBaseRepo(); err != nil {
+ log.Error("LoadBaseRepo: %v", err)
+ return "", fmt.Errorf("LoadBaseRepo: %v", err)
} else if pr.BaseRepo == nil {
log.Error("Pr %d BaseRepo %d does not exist", pr.ID, pr.BaseRepoID)
return "", &models.ErrRepoNotExist{