diff options
| author | Sean McGivern <sean@mcgivern.me.uk> | 2017-03-17 12:36:56 +0000 |
|---|---|---|
| committer | Sean McGivern <sean@mcgivern.me.uk> | 2017-03-17 12:36:56 +0000 |
| commit | d50034245a7ab7819bc83bb6e2796bbd384a7a8c (patch) | |
| tree | b63fb233b30f405e6aa4ac9bedc37f74273df93c /lib | |
| parent | 375b870b77ed2f8922f98327d8fdcfb6f6dc0e99 (diff) | |
| parent | 3f111741967a5dcb6e0418471d2b26ca9ab04eac (diff) | |
| download | gitlab-ce-d50034245a7ab7819bc83bb6e2796bbd384a7a8c.tar.gz | |
Merge branch '29604-v3-fix-branch-creation' into 'master'
Use "branch_name" instead "branch" on V3 branch creation API
Closes #29604
See merge request !10030
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/api/v3/branches.rb | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/lib/api/v3/branches.rb b/lib/api/v3/branches.rb index 7d9d6246e46..0a877b960f6 100644 --- a/lib/api/v3/branches.rb +++ b/lib/api/v3/branches.rb @@ -45,6 +45,27 @@ module API status(200) end + + desc 'Create branch' do + success ::API::Entities::RepoBranch + end + params do + requires :branch_name, type: String, desc: 'The name of the branch' + requires :ref, type: String, desc: 'Create branch from commit sha or existing branch' + end + post ":id/repository/branches" do + authorize_push_project + result = CreateBranchService.new(user_project, current_user). + execute(params[:branch_name], params[:ref]) + + if result[:status] == :success + present result[:branch], + with: ::API::Entities::RepoBranch, + project: user_project + else + render_api_error!(result[:message], 400) + end + end end end end |
