Commit a8501a23 authored by Lee Tickett's avatar Lee Tickett Committed by Nick Thomas

Quote branch names in how to merge instructions

parent bc06e9cd
...@@ -13,12 +13,13 @@ ...@@ -13,12 +13,13 @@
%pre.dark#merge-info-1 %pre.dark#merge-info-1
- if @merge_request.for_fork? - if @merge_request.for_fork?
:preserve :preserve
git fetch #{h default_url_to_repo(@merge_request.source_project)} #{h @merge_request.source_branch} -# All repo/branch refs have been quoted to allow support for special characters (such as #my-branch)
git checkout -b #{h @merge_request.source_project_path}-#{h @merge_request.source_branch} FETCH_HEAD git fetch "#{h default_url_to_repo(@merge_request.source_project)}" "#{h @merge_request.source_branch}"
git checkout -b "#{h @merge_request.source_project_path}-#{h @merge_request.source_branch}" FETCH_HEAD
- else - else
:preserve :preserve
git fetch origin git fetch origin
git checkout -b #{h @merge_request.source_branch} origin/#{h @merge_request.source_branch} git checkout -b "#{h @merge_request.source_branch}" "origin/#{h @merge_request.source_branch}"
%p %p
%strong Step 2. %strong Step 2.
Review the changes locally Review the changes locally
...@@ -31,20 +32,20 @@ ...@@ -31,20 +32,20 @@
- if @merge_request.for_fork? - if @merge_request.for_fork?
:preserve :preserve
git fetch origin git fetch origin
git checkout origin/#{h @merge_request.target_branch} git checkout "origin/#{h @merge_request.target_branch}"
git merge --no-ff #{h @merge_request.source_project_path}-#{h @merge_request.source_branch} git merge --no-ff "#{h @merge_request.source_project_path}-#{h @merge_request.source_branch}"
- else - else
:preserve :preserve
git fetch origin git fetch origin
git checkout origin/#{h @merge_request.target_branch} git checkout "origin/#{h @merge_request.target_branch}"
git merge --no-ff #{h @merge_request.source_branch} git merge --no-ff "#{h @merge_request.source_branch}"
%p %p
%strong Step 4. %strong Step 4.
Push the result of the merge to GitLab Push the result of the merge to GitLab
= clipboard_button(target: "pre#merge-info-4", title: "Copy commands to clipboard") = clipboard_button(target: "pre#merge-info-4", title: "Copy commands to clipboard")
%pre.dark#merge-info-4 %pre.dark#merge-info-4
:preserve :preserve
git push origin #{h @merge_request.target_branch} git push origin "#{h @merge_request.target_branch}"
- unless @merge_request.can_be_merged_by?(current_user) - unless @merge_request.can_be_merged_by?(current_user)
%p %p
Note that pushing to GitLab requires write access to this repository. Note that pushing to GitLab requires write access to this repository.
......
---
title: Quote branch names in how to merge instructions
merge_request: 32639
author: Lee Tickett
type: fixed
...@@ -64,7 +64,7 @@ describe 'Merge request > User selects branches for new MR', :js do ...@@ -64,7 +64,7 @@ describe 'Merge request > User selects branches for new MR', :js do
click_button "Check out branch" click_button "Check out branch"
expect(page).to have_content 'git checkout -b orphaned-branch origin/orphaned-branch' expect(page).to have_content 'git checkout -b "orphaned-branch" "origin/orphaned-branch"'
end end
it 'allows filtering multiple dropdowns' do it 'allows filtering multiple dropdowns' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment