gitea/services/pull
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
..
check.go Option to delay conflict checking of old pull requests until page view (#27779) 2025-04-24 19:26:57 +00:00
check_test.go Option to delay conflict checking of old pull requests until page view (#27779) 2025-04-24 19:26:57 +00:00
comment.go Update misspell to 0.5.1 and add `misspellings.csv` (#30573) 2024-04-27 08:03:49 +00: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_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
edits.go Implement FSFE REUSE for golang files (#21840) 2022-11-27 18:20:29 +00:00
lfs.go Remove GetByBean method because sometimes it's danger when query condition parameter is zero and also introduce new generic methods (#28220) 2023-12-07 15:27:36 +08:00
main_test.go make writing main test easier (#27270) 2023-09-28 01:38:53 +00:00
merge.go Always use an empty line to separate the commit message and trailer (#34512) 2025-06-02 06:29:16 +00:00
merge_ff_only.go Remove context from git struct (#33793) 2025-03-04 11:56:11 -08:00
merge_merge.go Remove context from git struct (#33793) 2025-03-04 11:56:11 -08:00
merge_prepare.go Option to delay conflict checking of old pull requests until page view (#27779) 2025-04-24 19:26:57 +00:00
merge_rebase.go Remove context from git struct (#33793) 2025-03-04 11:56:11 -08:00
merge_squash.go Always use an empty line to separate the commit message and trailer (#34512) 2025-06-02 06:29:16 +00:00
merge_test.go Always use an empty line to separate the commit message and trailer (#34512) 2025-06-02 06:29:16 +00:00
patch.go Option to delay conflict checking of old pull requests until page view (#27779) 2025-04-24 19:26:57 +00:00
patch_unmerged.go Remove context from git struct (#33793) 2025-03-04 11:56:11 -08:00
protected_branch.go Move git references checking to gitrepo packages to reduce expose of repository path (#33891) 2025-03-15 19:48:59 -07:00
pull.go Remove unnecessary duplicate code (#34552) 2025-06-03 16:27:29 +00:00
pull_test.go Simplify how git repositories are opened (#28937) 2024-01-27 21:09:51 +01:00
review.go Enable addtional linters (#34085) 2025-04-01 10:14:01 +00:00
review_test.go Prevent re-review and dismiss review actions on closed and merged PRs (#30065) 2024-03-28 15:19:24 +00:00
reviewer.go Fix get reviewers' bug (#32415) 2024-11-22 10:44:48 -05:00
reviewer_test.go Enable tenv and testifylint rules (#32852) 2024-12-15 10:41:29 +00:00
temp_repo.go Option to delay conflict checking of old pull requests until page view (#27779) 2025-04-24 19:26:57 +00:00
update.go Fix possible pull request broken when leave the page immediately after clicking the update button (#34509) 2025-06-04 17:09:08 +00:00
update_rebase.go Remove context from git struct (#33793) 2025-03-04 11:56:11 -08:00