BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
8f9c01fe
Commit
8f9c01fe
authored
Feb 12, 2013
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2946 from Asquera/fix/access_to_non_existent_branch
API: Fixes return code when accessing non existent branch (#2922)
parents
452adb7b
2bd95596
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
0 deletions
+9
-0
repositories.md
doc/api/repositories.md
+3
-0
projects.rb
lib/api/projects.rb
+1
-0
projects_spec.rb
spec/requests/api/projects_spec.rb
+5
-0
No files found.
doc/api/repositories.md
View file @
8f9c01fe
...
...
@@ -79,6 +79,9 @@ Parameters:
}
```
Will return status code
`200`
on success or
`404 Not found`
if the branch is not available.
## Protect a project repository branch
Protect a single project repository branch.
...
...
lib/api/projects.rb
View file @
8f9c01fe
...
...
@@ -230,6 +230,7 @@ module Gitlab
# GET /projects/:id/repository/branches/:branch
get
":id/repository/branches/:branch"
do
@branch
=
user_project
.
repo
.
heads
.
find
{
|
item
|
item
.
name
==
params
[
:branch
]
}
not_found!
(
"Branch does not exist"
)
if
@branch
.
nil?
present
@branch
,
with:
Entities
::
RepoObject
,
project:
user_project
end
...
...
spec/requests/api/projects_spec.rb
View file @
8f9c01fe
...
...
@@ -109,6 +109,11 @@ describe Gitlab::API do
json_response
[
'commit'
][
'id'
].
should
==
'621491c677087aa243f165eab467bfdfbee00be1'
json_response
[
'protected'
].
should
==
false
end
it
"should return a 404 error if branch is not available"
do
get
api
(
"/projects/
#{
project
.
id
}
/repository/branches/unknown"
,
user
)
response
.
status
.
should
==
404
end
end
describe
"PUT /projects/:id/repository/branches/:branch/protect"
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