forgejo/services/pull
Earl Warren ceea9c4334
Revert "avoid superfluous synchronized pull_request run when opening a PR"
The fix against the race incorrectly assumes the sha of the commit being
pushed belongs to the base repository. It finds the highest possible
pull request ID from the head repository instead of looking it up in
the base repository.

Figuring out if a PR was created in the future based on the highest
index of the base repository would require collecting all of them
because there is no way to know in advance which repository may be
involved in the race.

Fixing this race can be done either by:

* Introducing a new field in the pull_request table https://codeberg.org/forgejo/forgejo/pulls/2842
  which feels more like a hack than a real solution
* Refactoring the logic
  which would be a significant undertaking

The race has been in the codebase for a very long time and manifests
itself in the CI, when events happen in quick succession. The only
concrete manifestation was however fixed by https://codeberg.org/forgejo/forgejo/issues/2009

Since this race now only exists in theory and not in practice, let's
revert this bugous commit until a proper solution is implemented.

Fixes: https://codeberg.org/forgejo/forgejo/issues/2817

This reverts commit 036f1eddc5.

Conflicts:
	services/pull/pull.go
2024-03-28 07:08:17 +01:00
..
check.go
check_test.go
comment.go
commit_status.go Use db.ListOptionsAll instead of db.ListOptions{ListAll: true} (#29995) 2024-03-26 19:04:27 +01:00
commit_status_test.go
edits.go
lfs.go
main_test.go
merge.go Revert "avoid superfluous synchronized pull_request run when opening a PR" 2024-03-28 07:08:17 +01:00
merge_ff_only.go
merge_merge.go
merge_prepare.go
merge_rebase.go
merge_squash.go
merge_test.go
patch.go
patch_unmerged.go
pull.go Revert "avoid superfluous synchronized pull_request run when opening a PR" 2024-03-28 07:08:17 +01:00
pull_test.go
review.go Use db.ListOptionsAll instead of db.ListOptions{ListAll: true} (#29995) 2024-03-26 19:04:27 +01:00
temp_repo.go
update.go Revert "avoid superfluous synchronized pull_request run when opening a PR" 2024-03-28 07:08:17 +01:00
update_rebase.go