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
d06ebcf7
Commit
d06ebcf7
authored
Aug 04, 2021
by
Luke Duncalfe
Committed by
Mark Chao
Aug 04, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Handle when if project has no repository
parent
4e282783
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
0 deletions
+13
-0
lib/api/v3/github.rb
lib/api/v3/github.rb
+2
-0
spec/requests/api/v3/github_spec.rb
spec/requests/api/v3/github_spec.rb
+11
-0
No files found.
lib/api/v3/github.rb
View file @
d06ebcf7
...
@@ -214,6 +214,8 @@ module API
...
@@ -214,6 +214,8 @@ module API
update_project_feature_usage_for
(
user_project
)
update_project_feature_usage_for
(
user_project
)
next
[]
unless
user_project
.
repo_exists?
branches
=
::
Kaminari
.
paginate_array
(
user_project
.
repository
.
branches
.
sort_by
(
&
:name
))
branches
=
::
Kaminari
.
paginate_array
(
user_project
.
repository
.
branches
.
sort_by
(
&
:name
))
present
paginate
(
branches
),
with:
::
API
::
Github
::
Entities
::
Branch
,
project:
user_project
present
paginate
(
branches
),
with:
::
API
::
Github
::
Entities
::
Branch
,
project:
user_project
...
...
spec/requests/api/v3/github_spec.rb
View file @
d06ebcf7
...
@@ -472,6 +472,17 @@ RSpec.describe API::V3::Github do
...
@@ -472,6 +472,17 @@ RSpec.describe API::V3::Github do
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
end
end
context
'when the project has no repository'
,
:aggregate_failures
do
let_it_be
(
:project
)
{
create
(
:project
,
creator:
user
)
}
it
'returns an empty collection response'
do
jira_get
v3_api
(
"/repos/
#{
project
.
namespace
.
path
}
/
#{
project
.
path
}
/branches"
,
user
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
json_response
).
to
be_empty
end
end
end
end
context
'unauthenticated'
do
context
'unauthenticated'
do
...
...
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