mirror of
https://github.com/go-gitea/gitea.git
synced 2025-06-04 10:16:53 +02:00
fix status check in MergeRequiredContextsCommitStatus
This commit is contained in:
parent
e6dc1862ec
commit
ebeed31671
@ -237,7 +237,7 @@ func CalcCommitStatus(statuses []*CommitStatus) *CommitStatus {
|
|||||||
var lastStatus *CommitStatus
|
var lastStatus *CommitStatus
|
||||||
state := api.CommitStatusSuccess
|
state := api.CommitStatusSuccess
|
||||||
for _, status := range statuses {
|
for _, status := range statuses {
|
||||||
if status.State.HasHigherPriorityThan(state) {
|
if state == status.State || status.State.HasHigherPriorityThan(state) {
|
||||||
state = status.State
|
state = status.State
|
||||||
lastStatus = status
|
lastStatus = status
|
||||||
}
|
}
|
||||||
|
@ -61,6 +61,11 @@ func MergeRequiredContextsCommitStatus(commitStatuses []*git_model.CommitStatus,
|
|||||||
if matchedCount == 0 && returnedStatus == structs.CommitStatusSuccess {
|
if matchedCount == 0 && returnedStatus == structs.CommitStatusSuccess {
|
||||||
status := git_model.CalcCommitStatus(commitStatuses)
|
status := git_model.CalcCommitStatus(commitStatuses)
|
||||||
if status != nil {
|
if status != nil {
|
||||||
|
// FIXME: this check is not right, "status" can never be nil, but its fields can be empty if commitStatuses is empty
|
||||||
|
// here is just a quick patch to make it overall right.
|
||||||
|
if status.State == "" || status.State == structs.CommitStatusSkipped {
|
||||||
|
return structs.CommitStatusSuccess
|
||||||
|
}
|
||||||
return status.State
|
return status.State
|
||||||
}
|
}
|
||||||
return structs.CommitStatusSuccess
|
return structs.CommitStatusSuccess
|
||||||
|
Loading…
x
Reference in New Issue
Block a user