Merge pull request #2946 from Asquera/fix/access_to_non_existent_branch
API: Fixes return code when accessing non existent branch (#2922)
This commit is contained in:
commit
8f9c01feed
3 changed files with 9 additions and 0 deletions
|
@ -230,6 +230,7 @@ module Gitlab
|
|||
# GET /projects/:id/repository/branches/:branch
|
||||
get ":id/repository/branches/:branch" do
|
||||
@branch = user_project.repo.heads.find { |item| item.name == params[:branch] }
|
||||
not_found!("Branch does not exist") if @branch.nil?
|
||||
present @branch, with: Entities::RepoObject, project: user_project
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue