Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorSean McGivern <sean@mcgivern.me.uk>2017-03-17 15:36:56 +0300
committerDJ Mountney <david@twkie.net>2017-03-17 21:18:23 +0300
commitc19f36c97f2a861e86c3c7f3b945bcb3b80ddb22 (patch)
tree6c7cbb51e99aab3822b46c671fd7a9106255f3da /lib
parent01ff99cbe5b5dc7c3922149e6b0a2a449f36ab2f (diff)
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.rb21
1 files changed, 21 insertions, 0 deletions
diff --git a/lib/api/v3/branches.rb b/lib/api/v3/branches.rb
index 699e41b5537..c9a7be019e6 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