mirror of
https://github.com/go-gitea/gitea.git
synced 2026-10-10 13:26:53 +00:00
4e2c3e43f2
Creating a PR fetches the head commit into the base repo, then pushes the same objects into `refs/pull/N/head`. Since git 2.54, background repacks race that push: 1. The push can be rejected with "unable to migrate objects to permanent storage", see https://github.com/go-gitea/gitea/actions/runs/37171442185/job/111345034829. 2. For heads with 100+ new objects, the repack can delete the reused pack, leaving the PR ref pointing at missing objects. Fetching the head commit with `FetchRemoteTempCommit` and setting the PR ref with `UpdateRef` avoids both, as the fetch transfers nothing when the objects exist. Fork PR refs are now updated like AGit PR refs already are, without going through receive hooks. Also syncs the PR ref when a PR is reopened again. https://github.com/go-gitea/gitea/pull/37077 inverted that condition, so a reopened PR kept a stale ref. --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com> Co-authored-by: bircni <bircni@icloud.com>