Allow fast-forward-only merge when signed commits are required#37335
Open
krjakbrjak wants to merge 7 commits intogo-gitea:mainfrom
Open
Allow fast-forward-only merge when signed commits are required#37335krjakbrjak wants to merge 7 commits intogo-gitea:mainfrom
krjakbrjak wants to merge 7 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.
Member
|
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
Contributor
Author
Thanks for the review @silverwind . Went through the list:
A couple I'd like to push back on:
|
Member
|
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>
silverwind
approved these changes
Apr 21, 2026
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>
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.
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