Skip to content

Pull Request Pusher should be the author of the merge#36581

Merged
lunny merged 11 commits intogo-gitea:mainfrom
AdamMajer:pushes-is-author
Mar 2, 2026
Merged

Pull Request Pusher should be the author of the merge#36581
lunny merged 11 commits intogo-gitea:mainfrom
AdamMajer:pushes-is-author

Conversation

@AdamMajer
Copy link
Copy Markdown
Contributor

@AdamMajer AdamMajer commented Feb 10, 2026

In manual merge detected changes, the pushing user should be the de-facto author of the merge, not the committer. For ff-only merges, the author (PR owner) often have nothing to do with the merger. Similarly, even if a merge commit exists, it does not indicate that the merge commit author is the merger. This is especially true if the merge commit is a ff-only merge on a given branch.

If pusher is for some reason unavailable, we fall back to the old method of using committer or owning organization as the author.

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Feb 10, 2026
@github-actions github-actions bot added the modifies/go Pull requests that update Go code label Feb 10, 2026
@AdamMajer
Copy link
Copy Markdown
Contributor Author

AdamMajer commented Feb 10, 2026

It's not exactly clear that the pusher shouldn't always be considered the merger. For example, if someone merges manually one branch into another, but 3rd party is pushing this change to the target repo, it would make sense that the pusher is always the actual merger for the repository when it comes to manual merge detection. Should I just change the default behaviour always?

@lunny
Copy link
Copy Markdown
Member

lunny commented Feb 10, 2026

Yes, I believe the pusher should generally be regarded as the merger.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates manual-merge autodetection to attribute the merger correctly for fast-forward-only merges by using the branch pusher (while keeping existing behavior for merge commits), and adds an integration test to cover the new behavior.

Changes:

  • Adjust manuallyMerged merger resolution: merge commits use commit author email; fast-forward merges use base-branch pusher.
  • Add an integration test that performs a fast-forward merge via git merge + git push and asserts MergerID equals the pusher.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
services/pull/check.go Changes merger attribution logic for ff-only manual merges to use the recorded branch pusher.
tests/integration/manual_merge_test.go New integration test validating merger attribution for fast-forward manual merges.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread services/pull/check.go Outdated
Comment thread tests/integration/manual_merge_test.go
@silverwind
Copy link
Copy Markdown
Member

Please find a more descriptive title for this PR.

@AdamMajer AdamMajer changed the title Pushes is author Pull Request Pushes should be the author of the merge Feb 21, 2026
@AdamMajer AdamMajer changed the title Pull Request Pushes should be the author of the merge Pull Request Pusher should be the author of the merge Feb 21, 2026
@silverwind
Copy link
Copy Markdown
Member

Please address or resolve above two copilot comments.

@AdamMajer
Copy link
Copy Markdown
Contributor Author

Let's change this to always use the pusher as author of the merge, unless pusher is somehow unavailable.

In manual merge detected changes, the pushing user should be
the de-facto author of the merge, not the committer. For ff-only
merges, the author (PR owner) often have nothing to do with the
merger. Similarly, even if a merge commit exists, it does not
indicate that the merge commit author is the merger.

If pusher is for some reason unavailable, we fall back to the
old method of using committer or owning organization as the author.
Comment thread services/pull/check.go Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread services/pull/check.go Outdated
@wxiaoguang
Copy link
Copy Markdown
Contributor

Does the new change look good to you? Or anything else to address?

Comment thread services/pull/check.go Outdated
@AdamMajer
Copy link
Copy Markdown
Contributor Author

Does the new change look good to you? Or anything else to address?

Aside form my general question about user ==nil for ghost users, it looks good.

@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Mar 2, 2026
@wxiaoguang wxiaoguang added this to the 1.26.0 milestone Mar 2, 2026
@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Mar 2, 2026
@lunny lunny added reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. type/bug labels Mar 2, 2026
@lunny lunny enabled auto-merge (squash) March 2, 2026 18:40
@lunny lunny merged commit 37f6f7f into go-gitea:main Mar 2, 2026
26 checks passed
@GiteaBot GiteaBot removed the reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. label Mar 2, 2026
zjjhot added a commit to zjjhot/gitea that referenced this pull request Mar 4, 2026
* giteaofficial/main:
  [skip ci] Updated translations via Crowdin
  fix: /repos/{owner}/{repo}/actions/{runs,jobs} requiring owner permissions (go-gitea#36818)
  Fix CRAN package version validation to allow more than 4 version components (go-gitea#36813)
  Fix API not persisting pull request unit config when has_pull_requests is not set (go-gitea#36718)
  feat: Add Actions API rerun endpoints for runs and jobs (go-gitea#36768)
  Fix bug when pushing mirror with wiki (go-gitea#36795)
  Pull Request Pusher should be the author of the merge (go-gitea#36581)
  Delete non-exist branch should return 404 (go-gitea#36694)
  Remove API registration-token (go-gitea#36801)
  Add background and run count to actions list page (go-gitea#36707)
silverwind added a commit to silverwind/gitea that referenced this pull request Mar 6, 2026
* origin/main: (27 commits)
  Fix OAuth2 authorization code expiry and reuse handling (go-gitea#36797)
  Fix org permission API visibility checks for hidden members and private orgs (go-gitea#36798)
  Fix non-admins unable to automerge PRs from forks (go-gitea#36833)
  upgrade to github.com/cloudflare/circl 1.6.3, svgo 4.0.1, markdownlint-cli 0.48.0 (go-gitea#36837)
  Fix dump release asset bug (go-gitea#36799)
  build(deps): update material-icon-theme v5.32.0 (go-gitea#36832)
  Fix bug to check whether user can update pull request branch or rebase branch (go-gitea#36465)
  Fix forwarded proto handling for public URL detection (go-gitea#36810)
  Fix artifacts v4 backend upload problems (go-gitea#36805)
  Add a git grep search timeout (go-gitea#36809)
  fix(repo): unify DEFAULT_SHOW_FULL_NAME output in templates and dropdown (go-gitea#36597)
  Harden render iframe open-link handling (go-gitea#36811)
  [skip ci] Updated translations via Crowdin
  fix: /repos/{owner}/{repo}/actions/{runs,jobs} requiring owner permissions (go-gitea#36818)
  Fix CRAN package version validation to allow more than 4 version components (go-gitea#36813)
  Fix API not persisting pull request unit config when has_pull_requests is not set (go-gitea#36718)
  feat: Add Actions API rerun endpoints for runs and jobs (go-gitea#36768)
  Fix bug when pushing mirror with wiki (go-gitea#36795)
  Pull Request Pusher should be the author of the merge (go-gitea#36581)
  Delete non-exist branch should return 404 (go-gitea#36694)
  ...

# Conflicts:
#	routers/web/repo/issue_view.go
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. modifies/go Pull requests that update Go code type/bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants