summaryrefslogtreecommitdiffstats
path: root/services/pull
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2019-10-18 19:13:31 +0800
committerGitHub <noreply@github.com>2019-10-18 19:13:31 +0800
commit945f121262ef5a393d9530b62a82b2c141bbe21c (patch)
tree13d4d91da9a75295ee3455ff183a61c4d3fbb3ad /services/pull
parentfecd8f949dedac0751db99dec590ff12ae56818d (diff)
downloadgitea-945f121262ef5a393d9530b62a82b2c141bbe21c.tar.gz
gitea-945f121262ef5a393d9530b62a82b2c141bbe21c.zip
Fix bug on pull requests when transfer head repository (#8564)
* fix bug on pull requests when transfer head repository * add migration and fix lint * fix tests and add a cache check on LoadBaseRepo
Diffstat (limited to 'services/pull')
-rw-r--r--services/pull/merge.go11
1 files changed, 7 insertions, 4 deletions
diff --git a/services/pull/merge.go b/services/pull/merge.go
index 0d762dbc30..5eb8eaa4d4 100644
--- a/services/pull/merge.go
+++ b/services/pull/merge.go
@@ -71,7 +71,7 @@ func Merge(pr *models.PullRequest, doer *models.User, baseGitRepo *git.Repositor
}
}()
- headRepoPath := models.RepoPath(pr.HeadUserName, pr.HeadRepo.Name)
+ headRepoPath := pr.HeadRepo.RepoPath()
if err := git.InitRepository(tmpBasePath, false); err != nil {
return fmt.Errorf("git init: %v", err)
@@ -306,14 +306,17 @@ func Merge(pr *models.PullRequest, doer *models.User, baseGitRepo *git.Repositor
}
}
- headUser, err := models.GetUserByName(pr.HeadUserName)
+ var headUser *models.User
+ err = pr.HeadRepo.GetOwner()
if err != nil {
if !models.IsErrUserNotExist(err) {
- log.Error("Can't find user: %s for head repository - %v", pr.HeadUserName, err)
+ log.Error("Can't find user: %d for head repository - %v", pr.HeadRepo.OwnerID, err)
return err
}
- log.Error("Can't find user: %s for head repository - defaulting to doer: %s - %v", pr.HeadUserName, doer.Name, err)
+ log.Error("Can't find user: %d for head repository - defaulting to doer: %s - %v", pr.HeadRepo.OwnerID, doer.Name, err)
headUser = doer
+ } else {
+ headUser = pr.HeadRepo.Owner
}
env = models.FullPushingEnvironment(