ceea9c4334
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 036f1eddc53b31c28b2a7d808fada07f35b6f9b1. Conflicts: services/pull/pull.go