Directly write SHA of a merge train ref to the target branch instead of creating a new commit
Currently, Merge Trains discard temporary refs (cascading/combined refs) after a merge request is merged, however, we can use this temporary ref more effectively by directly writing the SHA into the target branch ref.
When a merge train runs, here is what happens in general:
- An MR gets on a merge train.
- The MR creates a cascading ref as a SHA
- The MR creates a new pipeline on
SHA-TMP-1, and this pipeline has passed.
- The MR gets merged, a merge train creates a new SHA
SHA-1on the target branch.
The point of this issue is to replace the
SHA-TMP-1 when the target branch is updated. Technically, these SHA contains the same history so that end result will be identical.
This issue is similar to #27117.
- What if the merge method is not no-ff? (e.g. ff-merge-only, squash option, etc)
Directly write SHA of a merge train ref to the target branch instead of creating a new commit.