From 09e0263e164648470126a099ce6bb1d64c3daf8f Mon Sep 17 00:00:00 2001 From: Elias Norberg Date: Sun, 29 Sep 2019 18:43:06 +0200 Subject: [PATCH 1/2] Use correct index when fetching commit status Signed-off-by: Elias Norberg --- templates/repo/issue/list.tmpl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/templates/repo/issue/list.tmpl b/templates/repo/issue/list.tmpl index 4874d97da45aa..e64cef2724ce8 100644 --- a/templates/repo/issue/list.tmpl +++ b/templates/repo/issue/list.tmpl @@ -212,8 +212,8 @@ {{.Title}} {{if .IsPull }} - {{if (index $.CommitStatus .ID)}} - {{template "repo/commit_status" (index $.CommitStatus .ID)}} + {{if (index $.CommitStatus .PullRequest.ID)}} + {{template "repo/commit_status" (index $.CommitStatus .PullRequest.ID)}} {{end}} {{end}} From 0eda059ebdc9c605eec04913e7c7b3332adad8a3 Mon Sep 17 00:00:00 2001 From: Elias Norberg Date: Sun, 29 Sep 2019 18:45:13 +0200 Subject: [PATCH 2/2] Compare against base repo to avoid mismatch when merging from fork Signed-off-by: Elias Norberg --- models/pull.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/models/pull.go b/models/pull.go index 60ccb144f510a..b41fb004e1fce 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 }