Skip to content

Commit ebeed31

Browse files
committed
fix status check in MergeRequiredContextsCommitStatus
1 parent e6dc186 commit ebeed31

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

models/git/commit_status.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ func CalcCommitStatus(statuses []*CommitStatus) *CommitStatus {
237237
var lastStatus *CommitStatus
238238
state := api.CommitStatusSuccess
239239
for _, status := range statuses {
240-
if status.State.HasHigherPriorityThan(state) {
240+
if state == status.State || status.State.HasHigherPriorityThan(state) {
241241
state = status.State
242242
lastStatus = status
243243
}

services/pull/commit_status.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,11 @@ func MergeRequiredContextsCommitStatus(commitStatuses []*git_model.CommitStatus,
6161
if matchedCount == 0 && returnedStatus == structs.CommitStatusSuccess {
6262
status := git_model.CalcCommitStatus(commitStatuses)
6363
if status != nil {
64+
// FIXME: this check is not right, "status" can never be nil, but its fields can be empty if commitStatuses is empty
65+
// here is just a quick patch to make it overall right.
66+
if status.State == "" || status.State == structs.CommitStatusSkipped {
67+
return structs.CommitStatusSuccess
68+
}
6469
return status.State
6570
}
6671
return structs.CommitStatusSuccess

0 commit comments

Comments
 (0)