0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo.git synced 2025-01-23 06:39:41 -05:00
forgejo/cmd
Lunny Xiao 7e81775184
Move database operations of merging a pull request to post receive hook and add a transaction (#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
https://github.com/go-gitea/gitea/pull/25741#issuecomment-2074126393

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>
(cherry picked from commit ebf0c969403d91ed80745ff5bd7dfbdb08174fc7)

Conflicts:
	modules/private/hook.go
	routers/private/hook_post_receive.go
	trivial conflicts because
	  263a716cb5 * Performance optimization for git push (#30104)
	was not cherry-picked and because of
	  998a431747 Do not update PRs based on events that happened before they existed
(cherry picked from commit eb792d9f8a)

(cherry picked from commit ec3f5f9992d7ff8250c044a4467524d53bd50210)
2024-05-14 15:37:32 +02:00
..
forgejo [REFACTOR] cli: prepareWorkPathAndCustomConf is not just for actions 2024-02-25 09:54:25 +01:00
actions.go
admin.go
admin_auth.go
admin_auth_ldap.go
admin_auth_ldap_test.go
admin_auth_oauth.go
admin_auth_stmp.go
admin_regenerate.go Revert "[BUG] Initalize Git for hook regeneration" 2024-02-26 22:30:25 +01:00
admin_user.go
admin_user_change_password.go Improve "must-change-password" logic and document (#30472) 2024-04-21 17:44:11 +02:00
admin_user_create.go fix(cli): admin user create first user never require a password change 2024-04-24 22:26:37 +00:00
admin_user_delete.go
admin_user_generate_access_token.go
admin_user_list.go
admin_user_must_change_password.go
cert.go
cmd.go
docs.go
doctor.go
doctor_convert.go
doctor_test.go
dump.go [BUG] Allow to exclude files in dump 2024-03-29 13:25:11 +01:00
dump_repo.go
dump_test.go [BUG] Allow to exclude files in dump 2024-03-29 13:25:11 +01:00
embedded.go
generate.go
hook.go Move database operations of merging a pull request to post receive hook and add a transaction (#30805) 2024-05-14 15:37:32 +02:00
hook_test.go Add unit tests for update git hook 2024-04-06 17:39:03 +00:00
keys.go Refactor cmd setup and remove deadcode (#29313) 2024-02-26 22:30:25 +01:00
mailer.go
main.go
main_test.go
manager.go
manager_logging.go
migrate.go
migrate_storage.go Fix missing migrate actions artifacts (#30874) (#30886) 2024-05-14 15:31:14 +02:00
migrate_storage_test.go
restore_repo.go
serv.go [REFACTOR] PKT protocol 2024-03-29 00:53:04 +01:00
web.go Clean up log messages (#30313) 2024-04-15 16:11:14 +02:00
web_acme.go
web_graceful.go
web_https.go