Allow fast-forward-only merge when signed commits are required#37335
Allow fast-forward-only merge when signed commits are required#37335silverwind merged 16 commits intogo-gitea:mainfrom
Conversation
handleFetchActionError captured resp.text() into respText and then called await resp.text() a second time inside JSON.parse(...). The second call throws "Failed to execute 'text' on 'Response': body stream already read", so every JSON 4xx error response surfaced that generic browser error instead of the translated server message. Reuse the already-captured text.
|
Some suggestions from a review pass:
Review written with the help of Claude Opus 4.7. |
Fast-forward-only creates no Gitea commit, so skip the "can Gitea sign" precheck for it. Pre-check head-commit verification for styles that preserve user commits on the target (merge, fast-forward-only) so a PR with unsigned commits surfaces a localized error instead of a 500 at the pre-receive hook. The dropdown still shows every configured style; the avatar and signing warning toggle per selection via data-pull-merge-style. Admin force-merge does not bypass the new check, matching the existing isSignedIfRequired behavior. Signed-off-by: Nikita Vakula <programmistov.programmist@gmail.com>
50a4623 to
d38d9fa
Compare
Thanks for the review @silverwind . Went through the list:
A couple I'd like to push back on:
|
|
I'll push a few cleanups. |
AllHeadCommitsVerified walks commits via CommitsBeforeUntil, which returns the range (merge-base..head] and therefore already checks headCommit. The explicit ParseCommitWithSignature(headCommit) before the helper call is a duplicate. Co-Authored-By: Claude (Opus 4.7) <noreply@anthropic.com>
checkHeadCommitsVerifiedIfRequired and isSignedIfRequired ran back-to-back for the merge style, each re-running GetFirstMatchProtectedBranchRule and opening the git repository. Fold both into checkSigningRequirements so a single protected-branch lookup and gitRepo open cover both checks. Co-Authored-By: Claude (Opus 4.7) <noreply@anthropic.com>
Remove comments that restated what variable names and surrounding code already convey. Kept the two non-obvious invariants (fast-forward-only rescue rationale, \$avatarColorFromSigning cascade constraint). Co-Authored-By: Claude (Opus 4.7) <noreply@anthropic.com>
Add rebase-merge to the won't-sign style list so all three Gitea-signed styles are exercised, and assert that admin force-merge does not bypass ErrHeadCommitsNotAllVerified (the pre-receive hook would reject the push regardless). Co-Authored-By: Claude (Opus 4.7) <noreply@anthropic.com>
The attribute now holds a comma-separated list of styles on most occurrences (for the signing-blocked rescue rows). Plural matches the semantics. Also inline the split result since it is only used once. Co-Authored-By: Claude (Opus 4.7) <noreply@anthropic.com>
|
The template is a mess and unmaintainable. Need to refactor and clean up the related code first -> Refactor pull request view #37380 |
Sounds good. Maybe it would make sense to drop the template changes from this PR and keep only the backend parts (the shared |
It sounds good, thank you! |
Signed-off-by: Nikita Vakula <programmistov.programmist@gmail.com>
Reverted the templates. only the backend part is kept. Should anything else be done here in your opinion? |
Signed-off-by: Nikita Vakula <programmistov.programmist@gmail.com>
Signed-off-by: Nikita Vakula <programmistov.programmist@gmail.com>
Signed-off-by: Nikita Vakula <programmistov.programmist@gmail.com>
Signed-off-by: wxiaoguang <wxiaoguang@gmail.com>
* origin/main: 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) # Conflicts: # routers/api/v1/repo/action.go # web_src/js/components/RepoActionView.vue
* 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: (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) ...
Fast-forward-only creates no Gitea commit, so skip the "can Gitea sign" precheck for it. Pre-check head-commit verification for styles that preserve user commits on the target (merge, fast-forward-only) so a PR with unsigned commits surfaces a localized error instead of a 500 at the pre-receive hook. The dropdown still shows every configured style; the avatar and signing warning toggle per selection via data-pull-merge-style.
Fixes #12272
Note: Admin force-merge does not bypass the new head-commits check. This matches the existing
isSignedIfRequiredbehavior.test-merge.webm