Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
31e2071d
Commit
31e2071d
authored
Jul 02, 2020
by
Kerri Miller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Suggest default_branch_name when available
parent
7784c290
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
2 deletions
+24
-2
app/views/projects/empty.html.haml
app/views/projects/empty.html.haml
+3
-2
spec/features/projects/show/user_sees_git_instructions_spec.rb
...features/projects/show/user_sees_git_instructions_spec.rb
+21
-0
No files found.
app/views/projects/empty.html.haml
View file @
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'
)
...
...
spec/features/projects/show/user_sees_git_instructions_spec.rb
View file @
31e2071d
...
...
@@ -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
)
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment