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
aa75a755
Commit
aa75a755
authored
Oct 31, 2014
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'api-delete-branch-json' into 'master'
Api delete branch json Fixes gitlab/gitlabhq#1478 See merge request !1233
parents
5a699090
20e04d9f
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
14 additions
and
1 deletion
+14
-1
branches_controller.rb
app/controllers/projects/branches_controller.rb
+1
-0
branches.md
doc/api/branches.md
+8
-0
branches.rb
lib/api/branches.rb
+4
-1
branches_spec.rb
spec/requests/api/branches_spec.rb
+1
-0
No files found.
app/controllers/projects/branches_controller.rb
View file @
aa75a755
...
...
@@ -19,6 +19,7 @@ class Projects::BranchesController < Projects::ApplicationController
def
create
result
=
CreateBranchService
.
new
(
project
,
current_user
).
execute
(
params
[
:branch_name
],
params
[
:ref
])
if
result
[
:status
]
==
:success
@branch
=
result
[
:branch
]
redirect_to
project_tree_path
(
@project
,
@branch
.
name
)
...
...
doc/api/branches.md
View file @
aa75a755
...
...
@@ -211,3 +211,11 @@ Parameters:
It return 200 if succeed, 404 if the branch to be deleted does not exist
or 400 for other reasons. In case of an error, an explaining message is provided.
Success response:
```
json
{
"branch_name"
:
"my-removed-branch"
}
```
lib/api/branches.rb
View file @
aa75a755
...
...
@@ -82,6 +82,7 @@ module API
authorize_push_project
result
=
CreateBranchService
.
new
(
user_project
,
current_user
).
execute
(
params
[
:branch_name
],
params
[
:ref
])
if
result
[
:status
]
==
:success
present
result
[
:branch
],
with:
Entities
::
RepoObject
,
...
...
@@ -104,7 +105,9 @@ module API
execute
(
params
[
:branch
])
if
result
[
:status
]
==
:success
true
{
branch_name:
params
[
:branch
]
}
else
render_api_error!
(
result
[
:message
],
result
[
:return_code
])
end
...
...
spec/requests/api/branches_spec.rb
View file @
aa75a755
...
...
@@ -146,6 +146,7 @@ describe API::API, api: true do
it
"should remove branch"
do
delete
api
(
"/projects/
#{
project
.
id
}
/repository/branches/
#{
branch_name
}
"
,
user
)
response
.
status
.
should
==
200
json_response
[
'branch_name'
].
should
==
branch_name
end
it
'should return 404 if branch not exists'
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