feat(api): add date range filtering to commit retrieval endpoints#34497
Merged
Conversation
Member
appleboy
commented
May 18, 2025
- Add support for filtering commits by date range via new "since" and "until" parameters
- Update API endpoints and command logic to handle the new parameters for fetching commits within given dates
- Extend API documentation and Swagger specs to describe the new "since" and "until" query parameters
- Refactor related function signatures and implementations to accept and pass "since" and "until" values
- Add support for filtering commits by date range via new "since" and "until" parameters - Update API endpoints and command logic to handle the new parameters for fetching commits within given dates - Extend API documentation and Swagger specs to describe the new "since" and "until" query parameters - Refactor related function signatures and implementations to accept and pass "since" and "until" values Signed-off-by: appleboy <appleboy.tw@gmail.com>
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR adds date range filtering to commit retrieval endpoints by introducing new "since" and "until" query parameters. Key changes include updates to the Swagger documentation, modifications to web and API route handlers for commit retrieval, and adjustments in the Git module functions to support the new parameters.
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| templates/swagger/v1_json.tmpl | Added "since" and "until" query parameter definitions for ISO 8601 date-time filtering. |
| routers/web/repo/commit.go | Updated commit retrieval to include empty "since" and "until" parameters by default. |
| routers/web/feed/branch.go | Updated branch feed logic to include new date filters with default empty values. |
| routers/api/v1/repo/commits.go | Extracted new query parameters and passed them through the API commits retrieval logic. |
| modules/git/repo_commit.go | Introduced commitsByRangeWithTime to support filtering by date range in Git commands. |
| modules/git/commit.go | Updated CommitsByRange to call the new commitsByRangeWithTime function with date filters. |
- Quote the values for --since and --until options to handle arguments containing spaces or special characters Signed-off-by: appleboy <appleboy.tw@gmail.com>
Member
|
The time parameters needs to be validated and it's better to have some tests. |
- Add validation for 'since' and 'until' parameters to ensure they follow ISO 8601 (RFC3339) format, returning an error if invalid Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
Member
Author
lunny
approved these changes
May 19, 2025
- Remove single quotes from the --since and --until options in git command invocations - Refactor command chaining for improved readability in repo_stats.go - Remove an unused TODO comment from the commits test file Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
hiifong
reviewed
May 19, 2025
- Remove single quotes from the --since and --until git command options to fix date formatting. Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
hiifong
approved these changes
May 20, 2025
zjjhot
added a commit
to zjjhot/gitea
that referenced
this pull request
May 21, 2025
* giteaofficial/main: [skip ci] Updated translations via Crowdin Fix ephemeral runner deletion (go-gitea#34447) ui: add a default tab on repo header when migrating (go-gitea#34503) Use run-name and evaluate workflow variables (go-gitea#34301) feat(api): add date range filtering to commit retrieval endpoints (go-gitea#34497) Export repo's manual merge settings (go-gitea#34502)
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.