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
7fa80b5b
Commit
7fa80b5b
authored
Dec 30, 2014
by
Marin Jankovski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update branch api not found messages to 'Branch not found'.
parent
0991d19c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
5 deletions
+6
-5
lib/api/branches.rb
lib/api/branches.rb
+5
-4
lib/api/helpers.rb
lib/api/helpers.rb
+1
-1
No files found.
lib/api/branches.rb
View file @
7fa80b5b
...
...
@@ -14,7 +14,8 @@ module API
# Example Request:
# GET /projects/:id/repository/branches
get
":id/repository/branches"
do
present
user_project
.
repository
.
branches
.
sort_by
(
&
:name
),
with:
Entities
::
RepoObject
,
project:
user_project
branches
=
user_project
.
repository
.
branches
.
sort_by
(
&
:name
)
present
branches
,
with:
Entities
::
RepoObject
,
project:
user_project
end
# Get a single branch
...
...
@@ -26,7 +27,7 @@ module API
# GET /projects/:id/repository/branches/:branch
get
':id/repository/branches/:branch'
,
requirements:
{
branch:
/.*/
}
do
@branch
=
user_project
.
repository
.
branches
.
find
{
|
item
|
item
.
name
==
params
[
:branch
]
}
not_found!
(
"Branch
does not exist"
)
if
@branch
.
nil?
not_found!
(
"Branch
"
)
unless
@branch
present
@branch
,
with:
Entities
::
RepoObject
,
project:
user_project
end
...
...
@@ -43,7 +44,7 @@ module API
authorize_admin_project
@branch
=
user_project
.
repository
.
find_branch
(
params
[
:branch
])
not_found!
unless
@branch
not_found!
(
"Branch"
)
unless
@branch
protected_branch
=
user_project
.
protected_branches
.
find_by
(
name:
@branch
.
name
)
user_project
.
protected_branches
.
create
(
name:
@branch
.
name
)
unless
protected_branch
...
...
@@ -63,7 +64,7 @@ module API
authorize_admin_project
@branch
=
user_project
.
repository
.
find_branch
(
params
[
:branch
])
not_found!
unless
@branch
not_found!
(
"Branch does not exist"
)
unless
@branch
protected_branch
=
user_project
.
protected_branches
.
find_by
(
name:
@branch
.
name
)
protected_branch
.
destroy
if
protected_branch
...
...
lib/api/helpers.rb
View file @
7fa80b5b
...
...
@@ -42,7 +42,7 @@ module API
def
user_project
@project
||=
find_project
(
params
[
:id
])
@project
||
not_found!
@project
||
not_found!
(
"Project"
)
end
def
find_project
(
id
)
...
...
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