diff options
author | Jan-Willem van der Meer <mail@jewilmeer.nl> | 2014-09-11 11:46:08 +0200 |
---|---|---|
committer | Jan-Willem van der Meer <mail@jewilmeer.nl> | 2014-09-11 11:46:08 +0200 |
commit | bf0de1a500e7a9aecc7c8bbf623ad39b75c6433b (patch) | |
tree | 382df65e2b17c91e03278d58bce8dce0129a6a7b /lib/api/branches.rb | |
parent | b18d1c2786c2a385d6b797734a1afad7a01ddf35 (diff) | |
parent | 78ec7d9c9d156fe556d165c1c096bf5534d62d25 (diff) | |
download | gitlab-ce-bf0de1a500e7a9aecc7c8bbf623ad39b75c6433b.tar.gz |
Merge remote-tracking branch 'origin/master' into feature-oauth-refactoring
Diffstat (limited to 'lib/api/branches.rb')
-rw-r--r-- | lib/api/branches.rb | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/lib/api/branches.rb b/lib/api/branches.rb index b32a4aa7bc2..4db5f61dd28 100644 --- a/lib/api/branches.rb +++ b/lib/api/branches.rb @@ -80,9 +80,17 @@ module API # 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 + result = CreateBranchService.new.execute(user_project, + params[:branch_name], + params[:ref], + current_user) + if result[:status] == :success + present result[:branch], + with: Entities::RepoObject, + project: user_project + else + render_api_error!(result[:message], 400) + end end # Delete branch @@ -99,7 +107,7 @@ module API if result[:state] == :success true else - render_api_error!(result[:message], 405) + render_api_error!(result[:message], result[:return_code]) end end end |