diff options
author | Ahmad Sherif <me@ahmadsherif.com> | 2018-02-16 21:39:43 +0100 |
---|---|---|
committer | Ahmad Sherif <me@ahmadsherif.com> | 2018-02-26 16:59:29 +0100 |
commit | c370f53cb68038b469ec219cf2ec248e62a72683 (patch) | |
tree | c8d0a5ce899eab4f20f5afa0addaa242209a72bf /app | |
parent | 2aa2731c8b827b6ecb0a87634aca13fe2398ac7e (diff) | |
download | gitlab-ce-c370f53cb68038b469ec219cf2ec248e62a72683.tar.gz |
Migrate recursive tree entries fetching to Gitaly
Diffstat (limited to 'app')
-rw-r--r-- | app/models/tree.rb | 20 |
1 files changed, 1 insertions, 19 deletions
diff --git a/app/models/tree.rb b/app/models/tree.rb index c89b8eca9be..4c1856b67a8 100644 --- a/app/models/tree.rb +++ b/app/models/tree.rb @@ -9,10 +9,9 @@ class Tree @repository = repository @sha = sha @path = path - @recursive = recursive git_repo = @repository.raw_repository - @entries = get_entries(git_repo, @sha, @path, recursive: @recursive) + @entries = Gitlab::Git::Tree.where(git_repo, @sha, @path, recursive) end def readme @@ -58,21 +57,4 @@ class Tree def sorted_entries trees + blobs + submodules end - - private - - def get_entries(git_repo, sha, path, recursive: false) - current_path_entries = Gitlab::Git::Tree.where(git_repo, sha, path) - ordered_entries = [] - - current_path_entries.each do |entry| - ordered_entries << entry - - if recursive && entry.dir? - ordered_entries.concat(get_entries(git_repo, sha, entry.path, recursive: true)) - end - end - - ordered_entries - end end |