diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2014-02-04 16:46:15 +0400 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2014-02-04 16:46:15 +0400 |
commit | 97a4d8aea46fb45894f6e47597320ed2f6a12495 (patch) | |
tree | 22303017b20c8caac6ea9aa4a946b1dc96916a65 /lib/api/repositories.rb | |
parent | bacfad1c651d7b880a07f5f417ccb64693150935 (diff) |
Improve code according to new gitlab_git
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'lib/api/repositories.rb')
-rw-r--r-- | lib/api/repositories.rb | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/lib/api/repositories.rb b/lib/api/repositories.rb index 878929b8032..cad64760abb 100644 --- a/lib/api/repositories.rb +++ b/lib/api/repositories.rb @@ -82,7 +82,7 @@ module API # Example Request: # GET /projects/:id/repository/tags get ":id/repository/tags" do - present user_project.repo.tags.sort_by(&:name).reverse, with: Entities::RepoObject + present user_project.repo.tags.sort_by(&:name).reverse, with: Entities::RepoObject, project: user_project end # Get a project repository commits @@ -141,15 +141,9 @@ module API path = params[:path] || nil commit = user_project.repository.commit(ref) - tree = Tree.new(user_project.repository, commit.id, path) + tree = user_project.repository.tree(commit.id, path) - trees = [] - - %w(trees blobs submodules).each do |type| - trees += tree.send(type).map { |t| {name: t.name, type: type.singularize, mode: t.mode, id: t.id} } - end - - trees + present tree.sorted_entries, with: Entities::RepoTreeObject end # Get a raw file contents @@ -233,4 +227,3 @@ module API end end end - |