summaryrefslogtreecommitdiff
path: root/lib/api/branches.rb
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2014-04-01 10:39:53 +0300
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2014-04-01 10:39:53 +0300
commit33a00ceeeacfc52272d25cef914a027b9bf13a2a (patch)
tree3baeffab781954259202a814f0d349517bae2e41 /lib/api/branches.rb
parent95b84e2c5aa92a5a8effc108fdbdf596dff4818c (diff)
downloadgitlab-ce-33a00ceeeacfc52272d25cef914a027b9bf13a2a.tar.gz
Create branch via API
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'lib/api/branches.rb')
-rw-r--r--lib/api/branches.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/api/branches.rb b/lib/api/branches.rb
index 6339094bd99..953c6100f8b 100644
--- a/lib/api/branches.rb
+++ b/lib/api/branches.rb
@@ -65,6 +65,21 @@ module API
present @branch, with: Entities::RepoObject, project: user_project
end
+
+ # Create branch
+ #
+ # Parameters:
+ # id (required) - The ID of a project
+ # branch_name (required) - The name of the branch
+ # ref (required) - Create branch from commit sha or existing branch
+ # Example Request:
+ # POST /projects/:id/repository/branches
+ post ":id/repository/branches" do
+ authorize_push_project
+ @branch = CreateBranchService.new.execute(user_project, params[:branch_name], params[:ref], current_user)
+
+ present @branch, with: Entities::RepoObject, project: user_project
+ end
end
end
end