mirror of
				https://gitee.com/gitea/gitea
				synced 2025-11-04 08:30:25 +08:00 
			
		
		
		
	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
This commit is contained in:
		@@ -190,7 +190,7 @@ func CreatePullRequest(ctx *context.APIContext, form api.CreatePullRequestOption
 | 
			
		||||
	)
 | 
			
		||||
 | 
			
		||||
	// Get repo/branch information
 | 
			
		||||
	headUser, headRepo, headGitRepo, compareInfo, baseBranch, headBranch := parseCompareInfo(ctx, form)
 | 
			
		||||
	_, headRepo, headGitRepo, compareInfo, baseBranch, headBranch := parseCompareInfo(ctx, form)
 | 
			
		||||
	if ctx.Written() {
 | 
			
		||||
		return
 | 
			
		||||
	}
 | 
			
		||||
@@ -265,15 +265,14 @@ func CreatePullRequest(ctx *context.APIContext, form api.CreatePullRequestOption
 | 
			
		||||
		DeadlineUnix: deadlineUnix,
 | 
			
		||||
	}
 | 
			
		||||
	pr := &models.PullRequest{
 | 
			
		||||
		HeadRepoID:   headRepo.ID,
 | 
			
		||||
		BaseRepoID:   repo.ID,
 | 
			
		||||
		HeadUserName: headUser.Name,
 | 
			
		||||
		HeadBranch:   headBranch,
 | 
			
		||||
		BaseBranch:   baseBranch,
 | 
			
		||||
		HeadRepo:     headRepo,
 | 
			
		||||
		BaseRepo:     repo,
 | 
			
		||||
		MergeBase:    compareInfo.MergeBase,
 | 
			
		||||
		Type:         models.PullRequestGitea,
 | 
			
		||||
		HeadRepoID: headRepo.ID,
 | 
			
		||||
		BaseRepoID: repo.ID,
 | 
			
		||||
		HeadBranch: headBranch,
 | 
			
		||||
		BaseBranch: baseBranch,
 | 
			
		||||
		HeadRepo:   headRepo,
 | 
			
		||||
		BaseRepo:   repo,
 | 
			
		||||
		MergeBase:  compareInfo.MergeBase,
 | 
			
		||||
		Type:       models.PullRequestGitea,
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// Get all assignee IDs
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user