-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Move database operations of merging a pull request to post receive hook and add a transaction #30805
Merged
Conversation
This file contains 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
GiteaBot
added
the
lgtm/need 2
This PR needs two approvals by maintainers to be considered for merging.
label
May 1, 2024
pull-request-size
bot
added
the
size/L
Denotes a PR that changes 100-499 lines, ignoring generated files.
label
May 1, 2024
github-actions
bot
added
modifies/go
Pull requests that update Go code
modifies/cli
PR changes something on the CLI, i.e. gitea doctor or gitea admin
labels
May 1, 2024
yp05327
reviewed
May 2, 2024
wxiaoguang
reviewed
May 2, 2024
wxiaoguang
reviewed
May 2, 2024
Any test code? |
wxiaoguang
reviewed
May 2, 2024
There are already enough tests for merging a pull request. And it's difficult to do a mock of updating database failure. |
I am sure |
… lunny/transaction_merge
@wxiaoguang Tests for auto-merge deletion added. 03ab2fa |
wxiaoguang
approved these changes
May 7, 2024
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
wolfogre
approved these changes
May 7, 2024
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 7, 2024
lunny
added
the
reviewed/wait-merge
This pull request is part of the merge queue. It will be merged soon.
label
May 7, 2024
GiteaBot
pushed a commit
to GiteaBot/gitea
that referenced
this pull request
May 7, 2024
…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 <wxiaoguang@gmail.com>
GiteaBot
added
backport/done
All backports for this PR have been created
and removed
reviewed/wait-merge
This pull request is part of the merge queue. It will be merged soon.
labels
May 7, 2024
zjjhot
added a commit
to zjjhot/gitea
that referenced
this pull request
May 8, 2024
* giteaofficial/main: [skip ci] Updated translations via Crowdin Apply to become a maintainer (go-gitea#30884) Refactor AppURL usage (go-gitea#30885) Move database operations of merging a pull request to post receive hook and add a transaction (go-gitea#30805) Fix missing migrate actions artifacts (go-gitea#30874)
lunny
added a commit
that referenced
this pull request
May 8, 2024
…ok and add a transaction (#30805) (#30888) 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. Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
lunny
added a commit
that referenced
this pull request
May 21, 2024
…ered (#30780) Replace #25741 Close #24445 Close #30658 Close #20646 ~Depends on #30805~ Since #25741 has been rewritten totally, to make the contribution easier, I will continue the work in this PR. Thanks @6543 --------- Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
GiteaBot
pushed a commit
to GiteaBot/gitea
that referenced
this pull request
May 21, 2024
…ered (go-gitea#30780) Replace go-gitea#25741 Close go-gitea#24445 Close go-gitea#30658 Close go-gitea#20646 ~Depends on go-gitea#30805~ Since go-gitea#25741 has been rewritten totally, to make the contribution easier, I will continue the work in this PR. Thanks @6543 --------- Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
lunny
added a commit
that referenced
this pull request
May 22, 2024
…ered (#30780) (#31039) Backport #30780 by @lunny Replace #25741 Close #24445 Close #30658 Close #20646 ~Depends on #30805~ Since #25741 has been rewritten totally, to make the contribution easier, I will continue the work in this PR. Thanks @6543 Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
backport/done
All backports for this PR have been created
backport/v1.22
This PR should be backported to Gitea 1.22
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
size/L
Denotes a PR that changes 100-499 lines, ignoring generated files.
type/bug
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.
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.