diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2013-04-03 16:55:08 +0400 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2013-04-03 16:55:08 +0400 |
commit | dfeef6c22849c04ffd225a0356fd11fb8e4907f6 (patch) | |
tree | 02eafb752d203a1ca93ee8442299771b3610d737 /lib/api/projects.rb | |
parent | 413a310faa17f626f351fa3afd6423e8782935a9 (diff) |
Fixed API file raw functionality, Fixed tree controller tests. Added BlobController specs
Diffstat (limited to 'lib/api/projects.rb')
-rw-r--r-- | lib/api/projects.rb | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/lib/api/projects.rb b/lib/api/projects.rb index ce94c34bd09..75157e55730 100644 --- a/lib/api/projects.rb +++ b/lib/api/projects.rb @@ -493,14 +493,16 @@ module Gitlab ref = params[:sha] - commit = user_project.repository.commit ref + repo = user_project.repository + + commit = repo.commit(ref) not_found! "Commit" unless commit - tree = Tree.new commit.tree, ref, params[:filepath] - not_found! "File" unless tree.try(:tree) + blob = Gitlab::Git::Blob.new(repo, commit.id, ref, params[:filepath]) + not_found! "File" unless blob.exists? - content_type tree.mime_type - present tree.data + content_type blob.mime_type + present blob.data end # Get a specific project's keys |