forgejo/modules
Lunny Xiao eb792d9f8a
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
2024-05-12 20:03:10 +02:00
..
actions Resolve lint for unused parameter and unnecessary type arguments (#30750) 2024-05-05 08:38:16 +01:00
activitypub
analyze
assetfs
auth Remove external API calls in TestPassword (#30716) 2024-05-05 12:15:40 +01:00
avatar Add codespell support and fix a good number of typos with its help (#3270) 2024-05-09 13:49:37 +00:00
base Refactor StringsToInt64s (#29967) 2024-03-26 19:04:26 +01:00
cache
charset s/Gitea/Forgejo in various log messages and comments 2024-04-21 21:26:15 +05:00
container Add container.FilterSlice function (gitea#30339) 2024-04-16 11:49:44 +02:00
csv
emoji
eventsource
forgefed feat(federation): validate like activities (#3494) 2024-05-07 07:59:49 +00:00
generate
git Make "sync branch" also sync object format and add tests (#30878) 2024-05-12 20:03:10 +02:00
gitgraph Add codespell support and fix a good number of typos with its help (#3270) 2024-05-09 13:49:37 +00:00
gitrepo
graceful [FIX] make pprof labels conformant with prometheus spec 2024-03-31 17:07:14 +02:00
hcaptcha
highlight Fix 2024-03-30 15:23:48 +01:00
hostmatcher
html
httpcache
httplib Skip gzip for some well-known compressed file types (#30796) 2024-05-05 12:15:40 +01:00
indexer Add codespell support and fix a good number of typos with its help (#3270) 2024-05-09 13:49:37 +00:00
issue/template
json
label
lfs fix: close file in the Upload func (#30262) 2024-04-07 15:40:31 +02:00
log Add codespell support and fix a good number of typos with its help (#3270) 2024-05-09 13:49:37 +00:00
markup Add codespell support and fix a good number of typos with its help (#3270) 2024-05-09 13:49:37 +00:00
mcaptcha
metrics
migration
nosql s/Gitea/Forgejo in various log messages and comments 2024-04-21 21:26:15 +05:00
optional Resolve lint for unused parameter and unnecessary type arguments (#30750) 2024-05-05 08:38:16 +01:00
options
packages Add support for npm bundleDependencies (#30751) 2024-05-05 08:24:01 +01:00
paginator
pprof
private Move database operations of merging a pull request to post receive hook and add a transaction (#30805) 2024-05-12 20:03:10 +02:00
process Add codespell support and fix a good number of typos with its help (#3270) 2024-05-09 13:49:37 +00:00
proxy
proxyprotocol
public
queue Add codespell support and fix a good number of typos with its help (#3270) 2024-05-09 13:49:37 +00:00
recaptcha
references
regexplru
repository Move database operations of merging a pull request to post receive hook and add a transaction (#30805) 2024-05-12 20:03:10 +02:00
secret
session Avoid importing modules/web/middleware in modules/session (#30584) 2024-04-21 16:28:16 +02:00
setting Resolve lint for unused parameter and unnecessary type arguments (#30750) 2024-05-05 08:38:16 +01:00
sitemap
ssh
storage
structs Fix no edit history after editing issue's title and content (#30814) 2024-05-05 12:15:40 +01:00
svg
sync
system
templates Add codespell support and fix a good number of typos with its help (#3270) 2024-05-09 13:49:37 +00:00
test
testlogger Add codespell support and fix a good number of typos with its help (#3270) 2024-05-09 13:49:37 +00:00
timeutil Remove the time-since class (#29826) 2024-03-20 08:46:30 +01:00
translation Rename ByteSize to ReadableSize 2024-03-31 20:17:12 +05:00
turnstile
typesniffer Add codespell support and fix a good number of typos with its help (#3270) 2024-05-09 13:49:37 +00:00
updatechecker
uri
user
util Add codespell support and fix a good number of typos with its help (#3270) 2024-05-09 13:49:37 +00:00
validation feat(federation): validate like activities (#3494) 2024-05-07 07:59:49 +00:00
web Avoid importing modules/web/middleware in modules/session (#30584) 2024-04-21 16:28:16 +02:00
webhook [FEAT] sourcehut webhooks 2024-04-05 10:20:40 +02:00