githaven-fork/services/migrations
Sebastian Brückner 02dae3f84b
Fix merge base commit for fast-forwarded GitLab PRs (#27825)
Due to a bug in the GitLab API, the diff_refs field is populated in the
response when fetching an individual merge request, but not when
fetching a list of them. That field is used to populate the merge base
commit SHA.
While there is detection for the merge base even when not populated by
the downloader, that detection is not flawless. Specifically, when a
GitLab merge request has a single commit, and gets merged with the
squash strategy, the base branch will be fast-forwarded instead of a
separate squash or merge commit being created. The merge base detection
attempts to find the last commit on the base branch that is also on the
PR branch, but in the fast-forward case that is the PR's only commit.
Assuming the head commit is also the merge base results in the import of
a PR with 0 commits and no diff.

This PR uses the individual merge request endpoint to fetch merge
request data with the diff_refs field. With its data, the base merge
commit can be properly set, which—by not relying on the detection
mentioned above—correctly imports PRs that were "merged" by
fast-forwarding the base branch.

ref: https://gitlab.com/gitlab-org/gitlab/-/issues/29620
2023-10-29 21:29:33 +08:00
..
codebase_test.go Implement FSFE REUSE for golang files (#21840) 2022-11-27 18:20:29 +00:00
codebase.go Replace interface{} with any (#25686) 2023-07-04 18:36:08 +00:00
common.go Replace interface{} with any (#25686) 2023-07-04 18:36:08 +00:00
dump.go Next round of db.DefaultContext refactor (#27089) 2023-09-16 14:39:12 +00:00
error.go Update github.com/google/go-github to v53 (#25157) 2023-06-09 19:42:51 +00:00
git.go Implement FSFE REUSE for golang files (#21840) 2022-11-27 18:20:29 +00:00
gitbucket.go Rewrite logger system (#24726) 2023-05-21 22:35:11 +00:00
gitea_downloader_test.go Implement FSFE REUSE for golang files (#21840) 2022-11-27 18:20:29 +00:00
gitea_downloader.go Rewrite logger system (#24726) 2023-05-21 22:35:11 +00:00
gitea_uploader_test.go Final round of db.DefaultContext refactor (#27587) 2023-10-14 08:37:24 +00:00
gitea_uploader.go Final round of db.DefaultContext refactor (#27587) 2023-10-14 08:37:24 +00:00
github_test.go Implement FSFE REUSE for golang files (#21840) 2022-11-27 18:20:29 +00:00
github.go Fix panic when migrating a repo from GitHub with issues (#25246) 2023-06-14 14:12:39 +08:00
gitlab_test.go GitLab migration: Sanitize response for reaction list (#25054) 2023-06-02 20:35:50 +00:00
gitlab.go Fix merge base commit for fast-forwarded GitLab PRs (#27825) 2023-10-29 21:29:33 +08:00
gogs_test.go Implement FSFE REUSE for golang files (#21840) 2022-11-27 18:20:29 +00:00
gogs.go Rewrite logger system (#24726) 2023-05-21 22:35:11 +00:00
http_client.go Implement FSFE REUSE for golang files (#21840) 2022-11-27 18:20:29 +00:00
main_test.go make writing main test easier (#27270) 2023-09-28 01:38:53 +00:00
migrate_test.go Implement FSFE REUSE for golang files (#21840) 2022-11-27 18:20:29 +00:00
migrate.go Next round of db.DefaultContext refactor (#27089) 2023-09-16 14:39:12 +00:00
onedev_test.go Implement FSFE REUSE for golang files (#21840) 2022-11-27 18:20:29 +00:00
onedev.go Replace interface{} with any (#25686) 2023-07-04 18:36:08 +00:00
restore.go Implement FSFE REUSE for golang files (#21840) 2022-11-27 18:20:29 +00:00
update.go Final round of db.DefaultContext refactor (#27587) 2023-10-14 08:37:24 +00:00