Commit fbbec4c1 authored by Andrew Fontaine's avatar Andrew Fontaine

Merge branch '221013-suggest-default_branch_name-when-available' into 'master'

Suggest default_branch_name when available

See merge request gitlab-org/gitlab!35915
parents 5d5ea8cd 31e2071d
- @content_class = "limit-container-width" unless fluid_layout
- default_branch_name = Gitlab::CurrentSettings.default_branch_name.presence || "master"
- breadcrumb_title _("Details")
- page_title _("Details")
......@@ -47,7 +48,7 @@
git commit -m "add README"
- if @project.can_current_user_push_to_default_branch?
%span><
git push -u origin master
git push -u origin #{ default_branch_name }
%fieldset
%h5= _('Push an existing folder')
......@@ -60,7 +61,7 @@
git commit -m "Initial commit"
- if @project.can_current_user_push_to_default_branch?
%span><
git push -u origin master
git push -u origin #{ default_branch_name }
%fieldset
%h5= _('Push an existing Git repository')
......
......@@ -18,6 +18,8 @@ RSpec.describe 'Projects > Show > User sees Git instructions' do
page.within '.empty-wrapper' do
expect(page).to have_content('Command line instructions')
end
expect(page).to have_content("git push -u origin master")
end
end
......@@ -59,6 +61,25 @@ RSpec.describe 'Projects > Show > User sees Git instructions' do
include_examples 'shows details of empty project with no repo'
end
context ":default_branch_name is specified" do
let_it_be(:project) { create(:project, :public) }
before do
expect(Gitlab::CurrentSettings)
.to receive(:default_branch_name)
.and_return('example_branch')
sign_in(project.owner)
visit project_path(project)
end
it "recommends default_branch_name instead of master" do
click_link 'Create empty repository'
expect(page).to have_content("git push -u origin example_branch")
end
end
context 'when project is empty' do
let_it_be(:project) { create(:project_empty_repo, :public) }
......
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