diff options
author | Elias Norberg <elias@aisle.se> | 2019-09-30 03:07:43 +0200 |
---|---|---|
committer | Lunny Xiao <xiaolunwen@gmail.com> | 2019-09-30 09:07:43 +0800 |
commit | 49547ea158ff2b028013cdcc12d18efc0556aac0 (patch) | |
tree | a0b48acc4d8707e6c83c07d461169de50fd183c4 /models | |
parent | 9c2a58456a698eae8a289de67685d4e3e270aaf9 (diff) | |
download | gitea-49547ea158ff2b028013cdcc12d18efc0556aac0.tar.gz gitea-49547ea158ff2b028013cdcc12d18efc0556aac0.zip |
Show correct commit status in PR list (#8316)
* Use correct index when fetching commit status
Signed-off-by: Elias Norberg <elias@aisle.se>
* Compare against base repo to avoid mismatch when merging from fork
Signed-off-by: Elias Norberg <elias@aisle.se>
Diffstat (limited to 'models')
-rw-r--r-- | models/pull.go | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/models/pull.go b/models/pull.go index 60ccb144f5..b41fb004e1 100644 --- a/models/pull.go +++ b/models/pull.go @@ -353,14 +353,17 @@ func (pr *PullRequest) GetLastCommitStatus() (status *CommitStatus, err error) { return nil, err } - repo := pr.HeadRepo lastCommitID, err := headGitRepo.GetBranchCommitID(pr.HeadBranch) if err != nil { return nil, err } - var statusList []*CommitStatus - statusList, err = GetLatestCommitStatus(repo, lastCommitID, 0) + err = pr.LoadBaseRepo() + if err != nil { + return nil, err + } + + statusList, err := GetLatestCommitStatus(pr.BaseRepo, lastCommitID, 0) if err != nil { return nil, err } |