aboutsummaryrefslogtreecommitdiffstats
path: root/models/git/commit_status_test.go
Commit message (Collapse)AuthorAgeFilesLines
* Keeping consistent between UI and API about combined commit status state and ↵Lunny Xiao11 days1-36/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Split GetLatestCommitStatus as two functions (#34535)Lunny Xiao2025-05-261-1/+24
| | | | | | | | Extract from #34531. This will reduce unnecessary count operation in databases. --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Enable tenv and testifylint rules (#32852)TheFox0x72024-12-151-2/+2
| | | | Enables tenv and testifylint linters closes: https://github.com/go-gitea/gitea/issues/32842
* Hide the "Details" link of commit status when the user cannot access actions ↵Zettat1232024-07-281-0/+25
| | | | | | | | | | | | | | | (#30156) Fix #26685 If a commit status comes from Gitea Actions and the user cannot access the repo's actions unit (the user does not have the permission or the actions unit is disabled), a 404 page will occur after clicking the "Details" link. We should hide the "Details" link in this case. <img src="https://github.com/go-gitea/gitea/assets/15528715/68361714-b784-4bb5-baab-efde4221f466" width="400px" />
* Fix duplicate status check contexts (#30660)Zettat1232024-04-301-0/+56
| | | | | | | | | | | | | | | | | Caused by #30076. There may be some duplicate status check contexts when setting status checks for a branch protection rule. The duplicate contexts should be removed. Before: <img src="https://github.com/go-gitea/gitea/assets/15528715/97f4de2d-4868-47a3-8a99-5a180f9ac0a3" width="600px" /> After: <img src="https://github.com/go-gitea/gitea/assets/15528715/ff7289c5-9793-4090-ba31-e8cb3c85f8a3" width="600px" />
* Add testing for CalcCommitStatus (#28823)Lunny Xiao2024-01-171-0/+115
|
* Fix `GetCommitStatuses` (#28787)KN4CK3R2024-01-151-1/+14
| | | Fixes #28764.
* Restore warning commit status (#27504)silverwind2023-10-081-0/+4
| | | | | | | | | | | | | Partial revert of https://github.com/go-gitea/gitea/pull/25839. This commit status is used by a number of external integrations, so I think we should not remove it (See https://github.com/go-gitea/gitea/pull/25839#issuecomment-1729002077). This is a rare case where an existing migration needed to be alterted to avoid data loss. --------- Co-authored-by: delvh <dev.lh@web.de> Co-authored-by: Giteabot <teabot@gitea.io>
* Remove commit status running and warning to align GitHub (#25839)caicandong2023-07-211-4/+0
| | | | | | | | | | | | | | | | | | | | | | Fix #25776. Close #25826. In the discussion of #25776, @wolfogre's suggestion was to remove the commit status of `running` and `warning` to keep it consistent with github. references: - https://docs.github.com/en/rest/commits/statuses?apiVersion=2022-11-28#about-commit-statuses ## :warning: BREAKING :warning: So the commit status of Gitea will be consistent with GitHub, only `pending`, `success`, `error` and `failure`, while `warning` and `running` are not supported anymore. --------- Co-authored-by: Jason Song <i@wolfogre.com>
* Use context parameter in models/git (#22367)Jason Song2023-01-091-6/+6
| | | | | | | | | After #22362, we can feel free to use transactions without `db.DefaultContext`. And there are still lots of models using `db.DefaultContext`, I think we should refactor them carefully and one by one. Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Implement FSFE REUSE for golang files (#21840)flynnnnnnnnnn2022-11-271-2/+1
| | | | | | | | | Change all license headers to comply with REUSE specification. Fix #16132 Co-authored-by: flynnnnnnnnnn <flynnnnnnnnnn@github> Co-authored-by: John Olheiser <john.olheiser@gmail.com>
* Refactor AssertExistsAndLoadBean to use generics (#20797)Lunny Xiao2022-08-161-1/+1
| | | | | | | * Refactor AssertExistsAndLoadBean to use generics * Fix tests Co-authored-by: zeripath <art27@cantab.net>
* Move some code into models/git (#19879)Lunny Xiao2022-06-121-0/+50
* Move access and repo permission to models/perm/access * fix test * Move some git related files into sub package models/git * Fix build * fix git test * move lfs to sub package * move more git related functions to models/git * Move functions sequence * Some improvements per @KN4CK3R and @delvh