Skip to content

Move database operations of merging a pull request to post receive hook and add a transaction (#30805) #30888

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 8, 2024

Conversation

GiteaBot
Copy link
Collaborator

@GiteaBot GiteaBot commented May 7, 2024

Backport #30805 by @lunny

Merging PR may fail because of various problems. The pull request may have a dirty state because there is no transaction when merging a pull request. ref #25741 (comment)

This PR moves all database update operations to post-receive handler for merging a pull request and having a database transaction. That means if database operations fail, then the git merging will fail, the git client will get a fail result.

There are already many tests for pull request merging, so we don't need to add a new one.

…ok and add a transaction (go-gitea#30805)

Merging PR may fail because of various problems. The pull request may
have a dirty state because there is no transaction when merging a pull
request. ref
go-gitea#25741 (comment)

This PR moves all database update operations to post-receive handler for
merging a pull request and having a database transaction. That means if
database operations fail, then the git merging will fail, the git client
will get a fail result.

There are already many tests for pull request merging, so we don't need
to add a new one.

---------

Co-authored-by: wxiaoguang <[email protected]>
@GiteaBot GiteaBot added modifies/cli PR changes something on the CLI, i.e. gitea doctor or gitea admin modifies/go Pull requests that update Go code type/bug labels May 7, 2024
@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label May 7, 2024
@GiteaBot GiteaBot added this to the 1.22.0 milestone May 7, 2024
@GiteaBot GiteaBot requested review from wolfogre and wxiaoguang May 7, 2024 07:36
@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 May 7, 2024
@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 May 8, 2024
@lunny lunny enabled auto-merge (squash) May 8, 2024 13:37
@lunny lunny added the reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. label May 8, 2024
@lunny lunny merged commit ec3f5f9 into go-gitea:release/v1.22 May 8, 2024
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 May 8, 2024
@go-gitea go-gitea locked as resolved and limited conversation to collaborators Aug 7, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. modifies/cli PR changes something on the CLI, i.e. gitea doctor or gitea admin modifies/go Pull requests that update Go code type/bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants