Skip to content

Use standard commit for merge commits on the train ref

Allison Browne requested to merge ab-use-standard-commit-msg-for-train-ref into master

What does this MR do and why?

Merge commits on the train ref look like:

Merge branch 1-3adee4d9-20cf-42d4-a6db-1bc715adbbb7 with refs/heads/main into refs/merge-requests/1/train

for semi linear merge strategy train ref merge commits will make it to the default branch.

We want to change them to use the default merge commit format as specified in your project settings. For instance without any changes that will look like:

Merge branch '6-c3158ed5-3174-475a-8e06-2c6e958a5900' into 'main' 

MR #: 6

See merge request !6

How to set up and validate locally

Example below:

  1. In rails console enable the experiment fully
    Feature.enable(:standard_merge_train_ref_merge_commit)
  2. Create a project with merge trains enabled. Using the code from !129728 (merged) we can do:
    rake gitlab:seed:merge_trains:project
  3. Use the merge commit or semi-linear merge strategy in the projects merge request settings
  4. Change the default merge commit message for the project to something recognizable in the projects mr settings
  5. Add an MR to the train
  6. Navigate to the pipeline tab and click on the commit for the pipeline with the 'merge train' label
  7. Change the url from /commit/ to /commits/ to see the full commit history for the train ref
  8. Confirm that the default url was used as the merge commit on the train ref
  9. Test with the various combinations of strategies with squash on and off
  10. Test with the various combinations of strategies with a custom squash or merge method for that MR

Screenshots

Merge strategy flag value screenshot
merge commit false Merge_commit_-no_squash-_flag_off
merge commit true merge_-commit_-_flag_on_no_squash
merge commit - with custom message true merge-commit_-custom-message_

We see the same style of merge commit messages for semi linear. FF lacks a merge commit message.

#422197 (closed)

Edited by Allison Browne

Merge request reports