summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorSebastian Ziebell <sebastian.ziebell@asquera.de>2013-02-08 17:04:08 +0100
committerSebastian Ziebell <sebastian.ziebell@asquera.de>2013-02-08 17:04:08 +0100
commit40e7846f3e25b7f679c9dda719c135fca1ef3d5b (patch)
tree6ff1748dc1a545eee2c1f1e45dd0d27e629ebe46 /lib
parent2f0a75ab77af430f682d67aa9bb865007d832795 (diff)
downloadgitlab-ce-40e7846f3e25b7f679c9dda719c135fca1ef3d5b.tar.gz
Status code 404 returned when retrieving non existent branch (issue #2922)
Accessing a repository branch that does not exist returns a 404 error instead of 200 now. Added a test.
Diffstat (limited to 'lib')
-rw-r--r--lib/api/projects.rb1
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/api/projects.rb b/lib/api/projects.rb
index a16243aa822..5e4c564c14b 100644
--- a/lib/api/projects.rb
+++ b/lib/api/projects.rb
@@ -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] }
+ error!("Branch does not exist", 404) if @branch.nil?
present @branch, with: Entities::RepoObject, project: user_project
end