Skip to content

Commit

Permalink
Compare against base repo to avoid mismatch when merging from fork
Browse files Browse the repository at this point in the history
Signed-off-by: Elias Norberg <elias@aisle.se>
  • Loading branch information
yzzyx committed Oct 1, 2019
1 parent c53521f commit bb46e7f
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions models/pull.go
Original file line number Diff line number Diff line change
Expand Up @@ -339,14 +339,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.GetBaseRepo()
if err != nil {
return nil, err
}

statusList, err := GetLatestCommitStatus(pr.BaseRepo, lastCommitID, 0)
if err != nil {
return nil, err
}
Expand Down

0 comments on commit bb46e7f

Please sign in to comment.