gitea/models/git
Lunny Xiao 6d0b24064a
Keeping consistent between UI and API about combined commit status state and fix some bugs (#34562)
Extract from #34531 

## Move Commit status state to a standalone package

Move the state from `structs` to `commitstatus` package. It also
introduce `CommitStatusStates` so that the combine function could be
used from UI and API logic.

## Combined commit status Changed

This PR will follow Github's combined commit status. Before this PR,
every commit status could be a combined one.
According to
https://docs.github.com/en/rest/commits/statuses?apiVersion=2022-11-28#get-the-combined-status-for-a-specific-reference
> Additionally, a combined state is returned. The state is one of:
> failure if any of the contexts report as error or failure
> pending if there are no statuses or a context is pending
> success if the latest status for all contexts is success

This PR will follow that rule and remove the `NoBetterThan` logic. This
also fixes the inconsistent between UI and API. In the API convert
package, it has implemented this which is different from the UI. It also
fixed the missing `URL` and `CommitURL` in the API.

## `CalcCommitStatus` return nil if there is no commit statuses

The behavior of `CalcCommitStatus` is changed. If the parameter commit
statuses is empty, it will return nil. The reference places should check
the returned value themselves.
2025-06-09 04:05:33 +00:00
..
branch.go Do not mutate incoming options to SearchRepositoryByName (#34553) 2025-06-02 17:33:25 +00:00
branch_list.go Fix branch order (#31174) 2024-05-31 09:58:41 +08:00
branch_test.go Enable testifylint rules (#34075) 2025-03-31 01:53:48 -04:00
commit_status.go Keeping consistent between UI and API about combined commit status state and fix some bugs (#34562) 2025-06-09 04:05:33 +00:00
commit_status_summary.go Keeping consistent between UI and API about combined commit status state and fix some bugs (#34562) 2025-06-09 04:05:33 +00:00
commit_status_test.go Keeping consistent between UI and API about combined commit status state and fix some bugs (#34562) 2025-06-09 04:05:33 +00:00
lfs.go refactor: remove redundant err declarations (#32381) 2024-10-30 19:36:24 +00:00
lfs_lock.go Show lock owner instead of repo owner on LFS setting page (#31788) 2024-08-11 14:48:20 +00:00
lfs_lock_list.go Show lock owner instead of repo owner on LFS setting page (#31788) 2024-08-11 14:48:20 +00:00
main_test.go make writing main test easier (#27270) 2023-09-28 01:38:53 +00:00
protected_branch.go Add priority to protected branch (#32286) 2024-11-27 05:41:06 +01:00
protected_branch_list.go Add priority to protected branch (#32286) 2024-11-27 05:41:06 +01:00
protected_branch_list_test.go Enable testifylint rules (#34075) 2025-03-31 01:53:48 -04:00
protected_branch_test.go Enable testifylint rules (#34075) 2025-03-31 01:53:48 -04:00
protected_tag.go Add tag protection via rest api #17862 (#31295) 2024-06-14 18:56:10 +02:00
protected_tag_test.go Implement FSFE REUSE for golang files (#21840) 2022-11-27 18:20:29 +00:00