Merge possible when rebase required
Summary
In GitLab v10.1.0 the merge methods semi-linear merge and ff-only were added to CE. These should disallow merging of merge requests which cannot be fast forwarded.
I have updated some of my projects to make use of the semi-linear merge method, but now merge requests can still be merged when it is not up to date with the target branch.
This does only happen when there are no conflicts in changed files though, if there are conflicts I do get the message I should first rebase my branch.
I have tested this on my CE installation of GitLab and on gitlab.com and found that this is a CE only issue.
Steps to reproduce
- Have a project in GitLab CE
- Make an edit to a file and create a MR for it
- Add another commit to the target branch of this MR (master) so our source branch is behind the target branch by some commit.
- Open the MR and see we can still merge it even though the target branch is ahead 1 commit.
Example Project
Cannot create an example project on gitlab.com as it runs GitLab EE which is not affected, only CE is.
What is the current bug behavior?
I can merge a MR with semi-linear or ff-only merge method enabled even though the target branch is ahead of the source branch.
What is the expected correct behavior?
I should see a message that tells me to rebase the source branch onto the target branch.
Relevant logs and/or screenshots
As you can see, my branch is 2 commits behind master, but I can still click merge and it will merge the MR.
Output of checks
Results of GitLab environment info
Expand for output related to GitLab environment info
System information System: Current User: git Using RVM: no Ruby Version: 2.3.5p376 Gem Version: 2.6.13 Bundler Version:1.13.7 Rake Version: 12.1.0 Redis Version: 3.2.5 Git Version: 2.13.6 Sidekiq Version:5.0.4 Go Version: unknown
GitLab information Version: 10.1.1 Revision: cc27e5f Directory: /opt/gitlab/embedded/service/gitlab-rails DB Adapter: postgresql URL: https://$SERVER_FQDN HTTP Clone URL: https://$SERVER_FQDN/some-group/some-project.git SSH Clone URL: git@$SERVER_FQDN:some-group/some-project.git Using LDAP: no Using Omniauth: no
GitLab Shell Version: 5.9.3 Repository storage paths:
- default: /var/opt/gitlab/git-data/repositories Hooks: /opt/gitlab/embedded/service/gitlab-shell/hooks Git: /opt/gitlab/embedded/bin/git
Results of GitLab application Check
Expand for output related to the GitLab application check
Checking GitLab Shell ...
GitLab Shell version >= 5.9.3 ? ... OK (5.9.3) Repo base directory exists? default... yes Repo storage directories are symlinks? default... no Repo paths owned by git:root, or git:git? default... yes Repo paths access is drwxrws---? default... yes hooks directories in repos are links: ... 8/2 ... ok 8/3 ... ok 8/4 ... ok 8/9 ... ok 8/10 ... ok 4/11 ... ok 4/12 ... ok 4/13 ... ok 8/14 ... ok 4/15 ... ok 8/21 ... ok 8/22 ... ok 13/27 ... ok 9/32 ... ok 4/33 ... ok 8/34 ... ok 9/35 ... ok 13/36 ... ok 13/37 ... ok 4/38 ... ok 9/39 ... ok 9/40 ... ok 9/41 ... ok 13/42 ... ok 8/43 ... ok 13/44 ... ok 8/46 ... ok 8/47 ... ok 13/48 ... ok 8/49 ... ok 4/50 ... ok 8/54 ... ok 9/55 ... ok 9/56 ... ok 9/63 ... ok 8/65 ... ok 53/66 ... ok 8/67 ... ok 9/68 ... ok 8/69 ... ok 8/74 ... ok 8/75 ... ok 53/77 ... ok 8/78 ... ok 8/81 ... ok 8/82 ... ok 8/83 ... ok 8/84 ... ok 4/85 ... ok 8/87 ... ok 8/88 ... ok 4/89 ... ok 4/90 ... ok 4/92 ... ok 8/94 ... ok 8/95 ... ok 55/96 ... ok 5/99 ... ok 8/101 ... ok 8/102 ... ok 8/104 ... ok 8/108 ... ok 5/109 ... ok 5/110 ... ok 8/111 ... ok 4/112 ... ok 5/114 ... ok 4/115 ... ok 4/116 ... ok 4/117 ... ok 4/118 ... ok 5/120 ... ok 5/123 ... ok 5/124 ... ok 4/125 ... ok 5/126 ... ok 8/127 ... ok 4/128 ... ok 4/129 ... ok 4/132 ... ok 5/133 ... ok 5/135 ... ok 4/136 ... ok 4/138 ... ok 8/139 ... ok 4/140 ... ok 8/141 ... ok 5/142 ... ok 4/143 ... ok 5/145 ... ok 4/146 ... ok 5/147 ... ok 5/149 ... ok 58/150 ... ok 5/151 ... ok 4/152 ... ok 4/153 ... ok 4/154 ... ok 8/155 ... ok 5/157 ... ok 4/158 ... ok 4/159 ... ok 8/160 ... ok 4/161 ... ok 58/164 ... ok 8/165 ... ok 58/166 ... ok 4/167 ... ok 58/168 ... ok Running /opt/gitlab/embedded/service/gitlab-shell/bin/check Check GitLab API access: OK Redis available via internal API: OK
Access to /var/opt/gitlab/.ssh/authorized_keys: OK gitlab-shell self-check successful
Checking GitLab Shell ... Finished
Checking Sidekiq ...
Running? ... yes Number of Sidekiq processes ... 1
Checking Sidekiq ... Finished
Reply by email is disabled in config/gitlab.yml Checking LDAP ...
LDAP is disabled in config/gitlab.yml
Checking LDAP ... Finished
Checking GitLab ...
Git configured correctly? ... yes Database config exists? ... yes All migrations up? ... yes Database contains orphaned GroupMembers? ... no GitLab config exists? ... yes GitLab config up to date? ... yes Log directory writable? ... yes Tmp directory writable? ... yes Uploads directory exists? ... yes Uploads directory has correct permissions? ... yes Uploads directory tmp has correct permissions? ... skipped (no tmp uploads folder yet) Init script exists? ... skipped (omnibus-gitlab has no init script) Init script up-to-date? ... skipped (omnibus-gitlab has no init script) Projects have namespace: ... 8/2 ... yes 8/3 ... yes 8/4 ... yes 8/9 ... yes 8/10 ... yes 4/11 ... yes 4/12 ... yes 4/13 ... yes 8/14 ... yes 4/15 ... yes 8/21 ... yes 8/22 ... yes 13/27 ... yes 9/32 ... yes 4/33 ... yes 8/34 ... yes 9/35 ... yes 13/36 ... yes 13/37 ... yes 4/38 ... yes 9/39 ... yes 9/40 ... yes 9/41 ... yes 13/42 ... yes 8/43 ... yes 13/44 ... yes 8/46 ... yes 8/47 ... yes 13/48 ... yes 8/49 ... yes 4/50 ... yes 8/54 ... yes 9/55 ... yes 9/56 ... yes 9/63 ... yes 8/65 ... yes 53/66 ... yes 8/67 ... yes 9/68 ... yes 8/69 ... yes 8/74 ... yes 8/75 ... yes 53/77 ... yes 8/78 ... yes 8/81 ... yes 8/82 ... yes 8/83 ... yes 8/84 ... yes 4/85 ... yes 8/87 ... yes 8/88 ... yes 4/89 ... yes 4/90 ... yes 4/92 ... yes 8/94 ... yes 8/95 ... yes 55/96 ... yes 5/99 ... yes 8/101 ... yes 8/102 ... yes 8/104 ... yes 8/108 ... yes 5/109 ... yes 5/110 ... yes 8/111 ... yes 4/112 ... yes 5/114 ... yes 4/115 ... yes 4/116 ... yes 4/117 ... yes 4/118 ... yes 5/120 ... yes 5/123 ... yes 5/124 ... yes 4/125 ... yes 5/126 ... yes 8/127 ... yes 4/128 ... yes 4/129 ... yes 4/132 ... yes 5/133 ... yes 5/135 ... yes 4/136 ... yes 4/138 ... yes 8/139 ... yes 4/140 ... yes 8/141 ... yes 5/142 ... yes 4/143 ... yes 5/145 ... yes 4/146 ... yes 5/147 ... yes 5/149 ... yes 58/150 ... yes 5/151 ... yes 4/152 ... yes 4/153 ... yes 4/154 ... yes 8/155 ... yes 5/157 ... yes 4/158 ... yes 4/159 ... yes 8/160 ... yes 4/161 ... yes 58/164 ... yes 8/165 ... yes 58/166 ... yes 4/167 ... yes 58/168 ... yes Redis version >= 2.8.0? ... yes Ruby version >= 2.3.3 ? ... yes (2.3.5) Git version >= 2.7.3 ? ... yes (2.13.6) Git user has default SSH configuration? ... yes Active users: ... 5
Checking GitLab ... Finished