Refactor pull request view (1)#37380
Conversation
0823a9a to
54daf12
Compare
72167c2 to
a07cac4
Compare
There was a problem hiding this comment.
Pull request overview
This PR continues an incremental refactor of the pull request view by introducing a structured PullRequestViewInfo, centralizing compare-info preparation, and switching GetCompareInfo to return a value to better support partial results.
Changes:
- Refactor
git_service.GetCompareInfoto return aCompareInfovalue (instead of a pointer) and populate commit IDs up-front (joining resolution errors). - Introduce
PullRequestViewInfoand consolidate PR compare-info filling logic inrouters/web/repo/pull.go. - Add
gitcmd.StderrContainshelper and update compare-info parsing helpers to return pointers to localCompareInfovalues.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| services/git/compare.go | Changes GetCompareInfo to return CompareInfo by value and partially populate fields earlier. |
| routers/web/repo/pull.go | Adds PullRequestViewInfo and refactors PR view/compare preparation logic around it. |
| routers/web/repo/issue_view.go | Runs PR-specific prepare functions only for pull issues. |
| routers/web/repo/compare.go | Updates ParseCompareInfo to return &compareInfo after GetCompareInfo becomes value-returning. |
| routers/api/v1/repo/pull.go | Adjusts API compare parsing and PR commits/files endpoints for value-returning GetCompareInfo. |
| modules/git/gitcmd/error.go | Adds StderrContains helper for stderr-based error matching. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
b794e69 to
b5919b6
Compare
5b6bbc6 to
7cd4fcf
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
7cd4fcf to
f6b192c
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
4a084f1 to
db27ec6
Compare
db27ec6 to
1701824
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 6 out of 6 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
One suggestion on the new helpers: Since they're only reachable through Reviewed with the help of Claude Opus 4.7 |
* origin/main: (127 commits) Refactor pull request view (1) (go-gitea#37380) Improve AGENTS.md (go-gitea#37382) Remove dead CSS (go-gitea#37376) Add pr-review e2e test and speed up e2e tests (go-gitea#37345) Drop Fomantic tab, checkbox and form patches (go-gitea#37377) fix: dump with default zip type produces uncompressed zip (go-gitea#37401) Allow fast-forward-only merge when signed commits are required (go-gitea#37335) Introduce `ActionRunAttempt` to represent each execution of a run (go-gitea#37119) Move review request functions to a standalone file (go-gitea#37358) Fix repo init README EOL (go-gitea#37388) Fix org team assignee/reviewer lookups for team member permissions (go-gitea#37365) Remove external service dependencies in migration tests (go-gitea#36866) Extend issue context popup beyond markdown content (go-gitea#36908) fix: commit status reporting (go-gitea#37372) Support for Custom URI Schemes in OAuth2 Redirect URIs (go-gitea#37356) Fix cmd tests by mocking builtin paths (go-gitea#37369) chore: upgrade Go version in devcontainer image to 1.26 (go-gitea#37374) Fix button layout shift when collapsing file tree in editor (go-gitea#37363) Update `Block a user` form (go-gitea#37359) Remove IsValidExternalURL/IsAPIURL and use IsValidURL at call sites (go-gitea#37364) ... # Conflicts: # modules/eventsource/event.go # tests/e2e/events.test.ts
* origin/main: feat(security): set X-Content-Type-Options: nosniff by default (go-gitea#37354) Refactor pull request view (1) (go-gitea#37380) Improve AGENTS.md (go-gitea#37382) Remove dead CSS (go-gitea#37376) Add pr-review e2e test and speed up e2e tests (go-gitea#37345) Drop Fomantic tab, checkbox and form patches (go-gitea#37377)
* origin/main: (51 commits) Fix color regressions, add `priority` color (go-gitea#37417) [skip ci] Updated translations via Crowdin Stabilize e2e logout propagation test (go-gitea#37403) refactor: serve site manifest via `/assets/site-manifest.json` endpoint (go-gitea#37405) feat(security): set X-Content-Type-Options: nosniff by default (go-gitea#37354) Refactor pull request view (1) (go-gitea#37380) Improve AGENTS.md (go-gitea#37382) Remove dead CSS (go-gitea#37376) Add pr-review e2e test and speed up e2e tests (go-gitea#37345) Drop Fomantic tab, checkbox and form patches (go-gitea#37377) fix: dump with default zip type produces uncompressed zip (go-gitea#37401) Allow fast-forward-only merge when signed commits are required (go-gitea#37335) Introduce `ActionRunAttempt` to represent each execution of a run (go-gitea#37119) Move review request functions to a standalone file (go-gitea#37358) Fix repo init README EOL (go-gitea#37388) Fix org team assignee/reviewer lookups for team member permissions (go-gitea#37365) Remove external service dependencies in migration tests (go-gitea#36866) Extend issue context popup beyond markdown content (go-gitea#36908) fix: commit status reporting (go-gitea#37372) Support for Custom URI Schemes in OAuth2 Redirect URIs (go-gitea#37356) ...
Follow up #37380 Some code is moved to the place whether it should be.


Need to do step by step
Refactor preparePullViewPullInfo and related functions, split them into small ones:
In prepareViewMergedPullInfo and preparePullViewFillInfo: call preparePullViewFillInfo consistnently
preparePullViewFillInfo calls preparePullViewFillCompareInfo and preparePullViewFillCommitStatusInfo