forgejo/routers/common
Bo-Yi Wu e025ec0131
feat(api): implement branch/commit comparison API (#30349)
- Add new `Compare` struct to represent comparison between two commits
- Introduce new API endpoint `/compare/*` to get commit comparison
information
- Create new file `repo_compare.go` with the `Compare` struct definition
- Add new file `compare.go` in `routers/api/v1/repo` to handle
comparison logic
- Add new file `compare.go` in `routers/common` to define `CompareInfo`
struct
- Refactor `ParseCompareInfo` function to use `common.CompareInfo`
struct
- Update Swagger documentation to include the new API endpoint for
commit comparison
- Remove duplicate `CompareInfo` struct from
`routers/web/repo/compare.go`
- Adjust base path in Swagger template to be relative (`/api/v1`)

GitHub API
https://docs.github.com/en/rest/commits/commits?apiVersion=2022-11-28#compare-two-commits

---------

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
(cherry picked from commit c70e442ce4b99e2a1f1bf216afcfa1ad78d1925a)

Conflicts:
	- routers/api/v1/swagger/repo.go
	  Conflict resolved by manually adding the lines from the Gitea
	  PR.
2024-04-21 11:58:18 +02:00
..
auth.go Move context from modules to services (#29440) 2024-03-06 12:10:43 +08:00
compare.go feat(api): implement branch/commit comparison API (#30349) 2024-04-21 11:58:18 +02:00
db.go [BRANDING] Use forgejo binary name 2024-02-05 16:05:02 +01:00
errpage.go Move context from modules to services (#29440) 2024-03-06 12:10:43 +08:00
errpage_test.go Clean up template locale usage (#27856) 2023-10-31 22:11:48 +08:00
markup.go Use relative links for commits, mentions, and issues in markdown (#29427) 2024-03-20 08:46:28 +01:00
middleware.go Fix incorrect cookie path for AppSubURL (#29534) 2024-03-06 12:10:46 +08:00
middleware_test.go Support sanitising the URL by removing extra slashes in the URL (#21333) 2023-03-04 21:31:24 +08:00
redirect.go Use fetch to send requests to create issues/comments (#25258) 2023-06-16 06:32:43 +00:00
serve.go Move context from modules to services (#29440) 2024-03-06 12:10:43 +08:00