When "No one" is allowed to push, the manual merge hint should not be shown
In our setup (local GitLab CE installation, version 8.16.2), the "master" branch of some repositories is protected, and "No one" is allowed to push to it. However, GitLab still presents the user with the message:
You can also accept this merge request manually using the (link: command line).
This message is not helpful, because the instructions shown when clicking the "command line" link contain "git push origin master" which fails with an error message:
remote: GitLab: You are not allowed to push code to protected branches on this project. To git@server:something/something.git ! [remote rejected] master -> master (pre-receive hook declined) error: failed to push some refs to 'git@server:something/something.git'
Steps to reproduce
- Create a repository and protect branch "master" so that Allowed to push is set to "No one".
- Create another branch and push it to the repository.
- Create a Merge Request and observe the behaviour described above.
What is the current bug behavior?
Hint about manually merging using the command line is shown, even though GitLab should know that this will not work.
What is the expected correct behavior?
Hint about manually merging should be suppressed in case the current user is not allowed to push, and especially if "No one" is allowed to push.
I suppose a check such as "can_be_pushed_to?" should be added in line 44 of app/views/projects/merge_requests/_show.html.haml