Skip to content

fix(pull): sign the commit when updating a branch by merge#38441

Open
eyupcanakman wants to merge 1 commit into
go-gitea:mainfrom
eyupcanakman:fix/sign-merge-update-branch
Open

fix(pull): sign the commit when updating a branch by merge#38441
eyupcanakman wants to merge 1 commit into
go-gitea:mainfrom
eyupcanakman:fix/sign-merge-update-branch

Conversation

@eyupcanakman

Copy link
Copy Markdown
Contributor

Updating a branch by merge produced an unsigned commit even when merges are configured to be signed. Update by rebase was unaffected.

Update() builds a fake reverse PR to switch head and base, and it has no Index, so pr.GetGitHeadRefName() resolves refs/pull/0/head. Since #36186 SignMerge looks that ref up in the base repository instead of the temporary merge repo. That lookup fails. The caller dropped the error, so sign stayed false.

Sync fork goes through the same fake-PR path.

Pass both sides of the merge to SignMerge as refs and evaluate them in the temp repo, where base and tracking always exist.

Tests cover a signed and an unsigned update by merge.

Fixes #38066

Assisted-by: Claude Code:claude-opus-4-8

`Update()` builds a fake reverse PR to switch head and base, and it has no `Index`, so `pr.GetGitHeadRefName()` resolves `refs/pull/0/head`. Since go-gitea#36186 `SignMerge` looks that ref up in the base repository instead of the temporary merge repo. That lookup fails. The caller dropped the error, so `sign` stayed false.

Pass both sides of the merge to `SignMerge` as refs and evaluate them in the temp repo, where `base` and `tracking` always exist.

Fixes go-gitea#38066

Assisted-by: Claude Code:claude-opus-4-8
@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Jul 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. type/bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

"Update branch by merge" fails to sign commits when SSH keys are used

2 participants