Merge MR by updating target branch to point to merge ref HEAD
Once we do https://gitlab.com/gitlab-org/gitlab-ce/issues/58495 and https://gitlab.com/gitlab-org/gitlab-ce/issues/58226, we can trust the merge ref to always be up to date if merge_status
== can_be_merged
, we should be able to reimplement the MergeRequests::MergeService
as MergeRequests::UpdateMergeRefService.new(...).execute(...) && repository.write_ref(target_branch, merge_ref)
. This means that, assuming the merge ref is already up to date, performing the merge should be near-instantaneous.
Of course, we will still need to verify that the target branch HEAD that was used to compute the merge ref actually matches what we're about to overwrite. We could return this SHA from the MergeToRefService
that will likely be called from inside the UpdateMergeRefService
, but that means it wouldn't be available if the merge ref is already up to date by the time the MergeToRefService
is called. We may need to store the source and target branch HEADs that were used to compute the merge ref somewhere so we have access to it at this time.
This page may contain information related to upcoming products, features and functionality. It is important to note that the information presented is for informational purposes only, so please do not rely on the information for purchasing or planning purposes. Just like with all projects, the items mentioned on the page are subject to change or delay, and the development, release, and timing of any products, features, or functionality remain at the sole discretion of GitLab Inc.