Merge commit with semi-linear history not working with protected branches
Summary
We recently decided to switch the merge method to Merge commit with semi-linear history. We have a master
branch (which is protected), a develop
branch (which is protected, too), all feature or bugfix branches are created from develop
.
I recently wanted to merge develop
into master
, the merge requested widget showed a message that fast-forward merge is not possible and that a rebase must be done. After clicking on the rebase button, an error message was shown (Something went wrong, without any further information what actually went wrong), and I was forced to rebase the develop
branch locally.
I checked the logs and found some entries in githost.log which showed that the RebaseService failed to rebase the branch because the branch is protected.
Steps to reproduce
- Create a new repository with branches
master
anddevelop
- Make both branches protected
- Add some commits to
develop
, merge intomaster
- Add some commits to
develop
- Switch merge method to Merge commit with semi-linear history
- Create a new MR to merge
develop
intomaster
- Check MR widget, click on Rebase
- Check githost.log for error logs
(If you are using an older version of GitLab, this will also determine whether the bug has been fixed in a more recent version)
What is the current bug behavior?
Protected branch cannot be rebased, but I'm allowed to merge into this branch (I'm the project master)
What is the expected correct behavior?
The protected branch should be rebased when the user rights are sufficient.
Relevant logs and/or screenshots
March 13, 2018 09:36 -> ERROR -> MergeRequests::RebaseService error (our-namespace/our-project!161): Rebase failed. Please rebase locally
March 13, 2018 09:36 -> ERROR -> MergeRequests::RebaseService error (our-namespace/our-projec!161): GitLab: You are not allowed to force push code to a protected branch on this project.<br>
Output of checks
Results of GitLab environment info
Expand for output related to GitLab environment info
System information System: Debian 9.4 Current User: git Using RVM: no Ruby Version: 2.3.6p384 Gem Version: 2.6.13 Bundler Version:1.13.7 Rake Version: 12.3.0 Redis Version: 3.2.11 Git Version: 2.14.3 Sidekiq Version:5.0.5 Go Version: unknownGitLab information Version: 10.5.4 Revision: 8d768f9 Directory: /opt/gitlab/embedded/service/gitlab-rails DB Adapter: postgresql URL: https://gitlab.ourdomain.net HTTP Clone URL: https://gitlab.ourdomain.net/some-group/some-project.git SSH Clone URL: git@ gitlab.ourdomain.net:some-group/some-project.git Using LDAP: yes Using Omniauth: no
GitLab Shell Version: 6.0.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 >= 6.0.3 ? ... OK (6.0.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: ... 7/4 ... ok 7/5 ... ok 12/6 ... ok 14/8 ... ok 16/9 ... ok 17/13 ... ok 16/14 ... ok 18/15 ... ok 20/16 ... ok 21/17 ... ok 14/18 ... ok 21/19 ... ok 21/20 ... ok 21/22 ... ok 24/23 ... ok 21/24 ... ok 21/25 ... ok 28/26 ... ok 28/27 ... ok 29/28 ... ok 14/29 ... ok 27/32 ... ok 29/34 ... ok 32/35 ... ok 21/36 ... ok 32/37 ... ok 74/39 ... ok 92/40 ... ok 92/41 ... ok 92/42 ... ok 92/43 ... ok 20/44 ... ok 92/45 ... ok 32/46 ... ok 92/48 ... ok 29/49 ... ok 14/50 ... ok 7/51 ... ok 29/53 ... ok 92/54 ... ok 92/56 ... ok 92/57 ... ok 45/58 ... ok 43/59 ... ok 92/60 ... ok 45/62 ... ok 45/63 ... ok 45/64 ... ok 45/65 ... ok 45/66 ... ok 45/67 ... ok 45/68 ... ok 45/69 ... ok 45/70 ... ok 45/71 ... ok 45/72 ... ok 45/73 ... ok 45/74 ... ok 45/75 ... ok 45/76 ... ok 14/77 ... ok 14/78 ... ok 14/79 ... ok 14/80 ... ok 45/81 ... ok 45/82 ... ok 11/83 ... ok 11/84 ... ok 68/86 ... ok 68/87 ... ok 92/88 ... ok 45/89 ... ok 92/91 ... ok 45/93 ... ok 74/94 ... ok 21/95 ... ok 45/96 ... ok 33/99 ... ok 74/100 ... ok 74/101 ... ok 45/102 ... ok 92/103 ... ok 75/104 ... ok 45/105 ... ok 74/106 ... ok 74/107 ... ok 33/108 ... ok 79/109 ... ok 74/110 ... ok 79/111 ... ok 74/112 ... ok 83/113 ... ok 83/114 ... ok 74/115 ... ok 83/116 ... ok 83/117 ... repository is empty 86/118 ... ok 86/119 ... ok 47/120 ... ok 72/121 ... ok 88/122 ... ok 88/123 ... ok 88/124 ... ok 72/125 ... ok 69/126 ... ok 89/127 ... ok 86/128 ... ok 88/129 ... ok 91/130 ... ok 91/131 ... ok 74/132 ... repository is empty 14/133 ... ok 21/134 ... ok 90/135 ... ok 86/136 ... ok 90/137 ... ok 47/139 ... ok 86/141 ... ok 86/142 ... 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 ...
Server: ldapmain LDAP authentication... Success LDAP users with access to your GitLab server (only showing the first 100 results) removed for security reasons
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? ... yes 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: ... 7/4 ... yes 7/5 ... yes 12/6 ... yes 14/8 ... yes 16/9 ... yes 17/13 ... yes 16/14 ... yes 18/15 ... yes 20/16 ... yes 21/17 ... yes 14/18 ... yes 21/19 ... yes 21/20 ... yes 21/22 ... yes 24/23 ... yes 21/24 ... yes 21/25 ... yes 28/26 ... yes 28/27 ... yes 29/28 ... yes 14/29 ... yes 27/32 ... yes 29/34 ... yes 32/35 ... yes 21/36 ... yes 32/37 ... yes 74/39 ... yes 92/40 ... yes 92/41 ... yes 92/42 ... yes 92/43 ... yes 20/44 ... yes 92/45 ... yes 32/46 ... yes 92/48 ... yes 29/49 ... yes 14/50 ... yes 7/51 ... yes 29/53 ... yes 92/54 ... yes 92/56 ... yes 92/57 ... yes 45/58 ... yes 43/59 ... yes 92/60 ... yes 45/62 ... yes 45/63 ... yes 45/64 ... yes 45/65 ... yes 45/66 ... yes 45/67 ... yes 45/68 ... yes 45/69 ... yes 45/70 ... yes 45/71 ... yes 45/72 ... yes 45/73 ... yes 45/74 ... yes 45/75 ... yes 45/76 ... yes 14/77 ... yes 14/78 ... yes 14/79 ... yes 14/80 ... yes 45/81 ... yes 45/82 ... yes 11/83 ... yes 11/84 ... yes 68/86 ... yes 68/87 ... yes 92/88 ... yes 45/89 ... yes 92/91 ... yes 45/93 ... yes 74/94 ... yes 21/95 ... yes 45/96 ... yes 33/99 ... yes 74/100 ... yes 74/101 ... yes 45/102 ... yes 92/103 ... yes 75/104 ... yes 45/105 ... yes 74/106 ... yes 74/107 ... yes 33/108 ... yes 79/109 ... yes 74/110 ... yes 79/111 ... yes 74/112 ... yes 83/113 ... yes 83/114 ... yes 74/115 ... yes 83/116 ... yes 83/117 ... yes 86/118 ... yes 86/119 ... yes 47/120 ... yes 72/121 ... yes 88/122 ... yes 88/123 ... yes 88/124 ... yes 72/125 ... yes 69/126 ... yes 89/127 ... yes 86/128 ... yes 88/129 ... yes 91/130 ... yes 91/131 ... yes 74/132 ... yes 14/133 ... yes 21/134 ... yes 90/135 ... yes 86/136 ... yes 90/137 ... yes 47/139 ... yes 86/141 ... yes 86/142 ... yes Redis version >= 2.8.0? ... yes Ruby version >= 2.3.5 ? ... yes (2.3.6) Git version >= 2.9.5 ? ... yes (2.14.3) Git user has default SSH configuration? ... yes Active users: ... 22
Checking GitLab ... Finished
Possible fixes
(If you can, link to the line of code that might be responsible for the problem)