mirror of
				https://github.com/go-gitea/gitea
				synced 2025-11-04 05:18:25 +00:00 
			
		
		
		
	Backport #10344 Ensure that pr.HeadRepo is loaded before using it in GetPullRequestCommitStatusState. Fixes error on merging with successful commit merge statuses.
This commit is contained in:
		@@ -91,6 +91,11 @@ func IsPullCommitStatusPass(pr *models.PullRequest) (bool, error) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
// GetPullRequestCommitStatusState returns pull request merged commit status state
 | 
					// GetPullRequestCommitStatusState returns pull request merged commit status state
 | 
				
			||||||
func GetPullRequestCommitStatusState(pr *models.PullRequest) (structs.CommitStatusState, error) {
 | 
					func GetPullRequestCommitStatusState(pr *models.PullRequest) (structs.CommitStatusState, error) {
 | 
				
			||||||
 | 
						// Ensure HeadRepo is loaded
 | 
				
			||||||
 | 
						if err := pr.LoadHeadRepo(); err != nil {
 | 
				
			||||||
 | 
							return "", errors.Wrap(err, "LoadHeadRepo")
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// check if all required status checks are successful
 | 
						// check if all required status checks are successful
 | 
				
			||||||
	headGitRepo, err := git.OpenRepository(pr.HeadRepo.RepoPath())
 | 
						headGitRepo, err := git.OpenRepository(pr.HeadRepo.RepoPath())
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user