You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
yp05327 7a687caca4
Fix wrong commit status in web ui (#26121)
Before:

![image](https://github.com/go-gitea/gitea/assets/18380374/8c5643b5-5c16-4674-9fe6-9e7fa2dda0b9)
After:

![image](https://github.com/go-gitea/gitea/assets/18380374/caf8891b-14df-418d-a7eb-977b54b9e9be)

There's a bug in the recent logic, `CalcCommitStatus` will always return
the first item of `statuses` or error status, because `state` is defined
with default value which should be `CommitStatusSuccess`

Then
``` golang
if status.State.NoBetterThan(state) {
```
this `if` will always return false unless `status.State =
CommitStatusError` which makes no sense.
So `lastStatus` will always be `nil` or error status.
Then we will always return the first item of `statuses` here or only
return error status, and this is why in the first picture the commit
status is `Success` but not `Failure`.

af1ffbcd63/models/git/commit_status.go (L204-L211)

Co-authored-by: Giteabot <teabot@gitea.io>
1 year ago
..
branch.go Exclude default branch from pushed branch hint (#25795) 1 year ago
branch_list.go Make FindBranches have stable result (#25631) 1 year ago
branch_test.go Fix branch commit message too long problem (#25588) 1 year ago
commit_status.go Fix wrong commit status in web ui (#26121) 1 year ago
commit_status_test.go Remove commit status running and warning to align GitHub (#25839) 1 year ago
lfs.go Replace `interface{}` with `any` (#25686) 1 year ago
lfs_lock.go Introduce path Clean/Join helper functions (#23495) 1 year ago
main_test.go Implement FSFE REUSE for golang files (#21840) 2 years ago
protected_banch_list_test.go Fix branch protection priority (#24045) 1 year ago
protected_branch.go Rename `repo.GetOwner` to `repo.LoadOwner` (#22967) 1 year ago
protected_branch_list.go Sync branches into databases (#22743) 1 year ago
protected_branch_test.go Supports wildcard protected branch (#20825) 2 years ago
protected_tag.go Use context parameter in models/git (#22367) 2 years ago
protected_tag_test.go Implement FSFE REUSE for golang files (#21840) 2 years ago