Refactor compare diff/pull page (1)#37481
Merged
bircni merged 3 commits intogo-gitea:mainfrom Apr 29, 2026
Merged
Conversation
This was referenced Apr 29, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
Refactors the compare diff / pull-related pages by renaming CompareInfo.MergeBase to a more accurate CompareBase, removing unused template context variables, and reducing direct access to untyped ctx.Data entries via small typed accessors/struct.
Changes:
- Rename
services/git.CompareInfo.MergeBasetoCompareBaseand update downstream usages (web + API). - Remove redundant
ctx.Data["Username"]/ctx.Data["Reponame"]assignments from several handlers. - Introduce
comparePageInfoTypeand typed helpers (GetWhitespaceBehavior,GetShowOutdatedComments) to decouple template/context access from rawctx.Datatype assertions.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| services/git/compare.go | Renames merge-base-related field to CompareBase and updates compare commit range generation. |
| routers/web/repo/wiki.go | Removes unused Username/Reponame template variables. |
| routers/web/repo/pull_review.go | Uses typed accessor for ShowOutdatedComments instead of raw type assertion. |
| routers/web/repo/pull.go | Updates PR compare logic to use CompareBase; uses typed accessors for whitespace/outdated options; removes unused template variables. |
| routers/web/repo/middlewares.go | Adds typed getters for WhitespaceBehavior and ShowOutdatedComments. |
| routers/web/repo/compare.go | Refactors compare page flow into comparePageInfoType, updates compare/PR creation logic for CompareBase, reduces ctx.Data lookups. |
| routers/web/repo/commit.go | Removes unused Username/Reponame; uses typed accessor for whitespace behavior. |
| routers/api/v1/repo/pull.go | Updates API PR creation / PR files compare start commit to use CompareBase. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
lunny
approved these changes
Apr 29, 2026
bircni
approved these changes
Apr 29, 2026
silverwind
added a commit
to silverwind/gitea
that referenced
this pull request
Apr 30, 2026
* origin/main: Refactor CI workflows (go-gitea#37487) Allow multiple projects per issue and pull requests (go-gitea#36784) [skip ci] Updated translations via Crowdin Refactor compare diff/pull page (1) (go-gitea#37481) Fix review submission from single-commit PR view (go-gitea#37475) Refactor integration tests infrastructure (go-gitea#37462) Fix allow maintainer edit permission check (go-gitea#37479) Serve OpenAPI 3.0 spec at /openapi.v1.json (go-gitea#37038) Batch-load related data in actions run, job, and task API endpoints (go-gitea#37032) Add DEFAULT_TITLE_SOURCE setting for pull request title default behavior (go-gitea#37465) Fix compare dropdown for branches without common history (go-gitea#37470) FIX: URL sanitization to handle schemeless credentials (go-gitea#37440) Refactor pull request view (4) (go-gitea#37451) # Conflicts: # modules/indexer/issues/elasticsearch/elasticsearch.go
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
ctx.Data["Username"]andctx.Data["Reponame"]