feat(api): implement branch/commit comparison API#30349
Merged
lunny merged 13 commits intogo-gitea:mainfrom Apr 16, 2024
Merged
feat(api): implement branch/commit comparison API#30349lunny merged 13 commits intogo-gitea:mainfrom
lunny merged 13 commits intogo-gitea:mainfrom
Conversation
Member
|
Sorry, the code looks like duplicated to previous blocks. |
Member
Author
|
@lunny Yes, so I remove some unused logic for API |
6a38ce9 to
3238464
Compare
Member
|
It's better to have an integration test for the API. |
- 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`) Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
- Add a new `swaggerCompare` struct for API response in `repo.go` - Update the `basePath` in `v1_json.tmpl` to include `AppSubUrl` - Define a new `Compare` object in Swagger JSON template with properties `commits` and `total_commits` - Add a reference to the `Compare` definition in Swagger JSON template Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
Signed-off-by: appleboy <appleboy.tw@gmail.com>
Signed-off-by: appleboy <appleboy.tw@gmail.com>
Signed-off-by: appleboy <appleboy.tw@gmail.com>
Member
Author
Signed-off-by: appleboy <appleboy.tw@gmail.com>
Member
Author
|
Added permission check |
lunny
reviewed
Apr 13, 2024
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Member
|
Sorry, I cannot give my approval since the gitea/routers/web/repo/compare.go Lines 200 to 574 in 708e87e It contains complex logic and detailed comments which make me believe it shouldn't be maintained in two places. |
Member
Author
|
@wolfogre Yes, in the next phase I will refactor the |
- Remove unused imports and functions - Refactor the `ParseCompareInfo` function to simplify the logic - Update variable names for clarity - Adjust the comparison of commits in the `CompareDiff` function Signed-off-by: appleboy <appleboy.tw@gmail.com>
Member
Author
lunny
approved these changes
Apr 15, 2024
wolfogre
approved these changes
Apr 16, 2024
zjjhot
added a commit
to zjjhot/gitea
that referenced
this pull request
Apr 17, 2024
* giteaofficial/main: Reduce unnecessary database queries on actions table (go-gitea#30509) [skip ci] Updated translations via Crowdin Tweak and fix toggle checkboxes (go-gitea#30527) Tweak repo buttons on mobile and labeled button border-radius (go-gitea#30503) Fix long branch name overflows (go-gitea#30345) Update API to return 'source_id' for users (go-gitea#29718) Allow `preferred_username` as username source for OIDC (go-gitea#30454) Fix empty field `login_name` in API response JSON when creating user (go-gitea#30511) feat(api): implement branch/commit comparison API (go-gitea#30349)
This was referenced Apr 20, 2024
silverwind
pushed a commit
that referenced
this pull request
Apr 21, 2024
- Update branch existence check to also include tag existence check - Adjust error message for branch/tag existence check ref: #30349 --------- Signed-off-by: appleboy <appleboy.tw@gmail.com> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com> Co-authored-by: Giteabot <teabot@gitea.io>
lunny
added a commit
that referenced
this pull request
Apr 23, 2024
The swagger format on #30349 is not right. This PR will fix it.
caarlos0
added a commit
to goreleaser/goreleaser
that referenced
this pull request
Apr 23, 2024
- Add `strings` package import to `gitea.go` - Implement `Changelog` function in `gitea.go` - Update `useGitea` constant in `changelog.go` - Add test for `useGitea` in `changelog_test.go` - Update `changelog.md` with information about `gitea` customization ref: * Server API: go-gitea/gitea#30349 * SDK: https://gitea.com/gitea/go-sdk/pulls/659 --------- Signed-off-by: appleboy <appleboy.tw@gmail.com> Co-authored-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
meschbach
pushed a commit
to meschbach/gitea-sdk
that referenced
this pull request
Apr 24, 2024
See the API: go-gitea/gitea#30349 - Add a new file `repo_compare.go` with package `gitea` and `Compare` struct - Implement `CompareCommits` method in `Client` struct in `repo_compare.go` - Add `version1_22_0` constant in `version.go` Signed-off-by: appleboy <appleboy.tw@gmail.com> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Reviewed-on: https://gitea.com/gitea/go-sdk/pulls/659 Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: appleboy <appleboy.tw@gmail.com> Co-committed-by: appleboy <appleboy.tw@gmail.com>
DennisRasey
pushed a commit
to DennisRasey/forgejo
that referenced
this pull request
Apr 30, 2024
- Update branch existence check to also include tag existence check - Adjust error message for branch/tag existence check ref: go-gitea/gitea#30349 --------- Signed-off-by: appleboy <appleboy.tw@gmail.com> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com> Co-authored-by: Giteabot <teabot@gitea.io> (cherry picked from commit 6459c50278906893f3cbc2bf3e52eff65e739b37)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Comparestruct to represent comparison between two commits/compare/*to get commit comparison informationrepo_compare.gowith theComparestruct definitioncompare.goinrouters/api/v1/repoto handle comparison logiccompare.goinrouters/commonto defineCompareInfostructParseCompareInfofunction to usecommon.CompareInfostructCompareInfostruct fromrouters/web/repo/compare.go/api/v1)GitHub API https://docs.github.com/en/rest/commits/commits?apiVersion=2022-11-28#compare-two-commits