0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo.git synced 2025-02-05 21:29:23 -05:00
forgejo/services
Earl Warren 50822f361e
Do not update PRs based on events that happened before they existed
* Split TestPullRequest out of AddTestPullRequestTask
* A Created field is added to the Issue table
* The Created field is set to the time (with nano resolution) on creation
* Record the nano time repo_module.PushUpdateOptions is created by the hook
* The decision to update a pull request created before a commit was
  pushed is based on the time (with nano resolution) the git hook
  was run and the Created field

It ensures the following happens:

* commit C is pushed
* the git hook queues AddTestPullRequestTask for processing and returns with success
* TestPullRequest is not called yet
* a pull request P with commit C as the head is created
* TestPullRequest runs and ignores P because it was created after the commit was received

When the "created" column is NULL, no verification is done, pull
requests that were created before the column was created in the
database cannot be newer than the latest call to a git hook.

Fixes: https://codeberg.org/forgejo/forgejo/issues/2009
(cherry picked from commit 998a431747)

Conflicts:
	models/forgejo_migrations/migrate.go
	see https://codeberg.org/forgejo/forgejo/pulls/3165#issuecomment-1755941
	services/pull/pull.go
	trivial conflicts
2024-04-12 10:41:19 +02:00
..
actions Remove scheduled action tasks if the repo is archived (#30224) (#30230) 2024-04-08 11:41:39 +02:00
agit
asymkey
attachment
auth Migrate margin and padding helpers to tailwind (#30043) 2024-03-30 07:17:29 +01:00
automerge
context
contexttest add label filters in org/{org_name}/issues 2024-04-04 17:37:56 +00:00
convert [v7.0/forgejo] Add optional pronoun field in user settings (#3076) 2024-04-06 13:23:43 +00:00
cron Update checker setting updates 2024-04-10 20:55:35 +00:00
doctor Merge pull request '[v7.0/forgejo] [BUG] Don't remove builtin OAuth2 applications' (#3069) from bp-v7.0/forgejo-6af8f3a into v7.0/forgejo 2024-04-06 12:43:33 +00:00
externalaccount
feed
forgejo
forms [v7.0/forgejo] Add optional pronoun field in user settings (#3076) 2024-04-06 13:23:43 +00:00
gitdiff [PERFORMANCE] git check-attr on bare repo if supported 2024-03-28 10:52:51 +01:00
indexer
issue [Port] gitea#29999: Fix Add/Remove WIP on pull request title failure 2024-03-29 12:21:51 +01:00
lfs
mailer
markup [v7.0/forgejo] Render inline file permalinks 2024-04-01 16:15:58 +02:00
migrations Fix duplicate migrated milestones (#30102) 2024-03-30 07:17:30 +01:00
mirror
notify
org
packages
pull Do not update PRs based on events that happened before they existed 2024-04-12 10:41:19 +02:00
release
repository Do not update PRs based on events that happened before they existed 2024-04-12 10:41:19 +02:00
secrets
task
uinotification
user [v7.0/forgejo] Add optional pronoun field in user settings (#3076) 2024-04-06 13:23:43 +00:00
webhook webhook: add admin-hooks tests 2024-04-09 21:57:34 +00:00
wiki