Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRebeca Méndez <scullymb@gmail.com>2016-08-29 18:23:40 +0300
committerRebeca Méndez <scullymb@gmail.com>2016-11-12 12:00:39 +0300
commit5c966f70fb218d6f4de0f888733604293f36c33e (patch)
treeecb15585624aaa4c266345e5e65d447f474b817a /lib/api/repositories.rb
parent6eeff67c6e03233d4480a55d05d4e0f1a88aef4c (diff)
Issue #4270: Recursive option for files through API
Diffstat (limited to 'lib/api/repositories.rb')
-rw-r--r--lib/api/repositories.rb4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/api/repositories.rb b/lib/api/repositories.rb
index f55aceed92c..0bb2f74809a 100644
--- a/lib/api/repositories.rb
+++ b/lib/api/repositories.rb
@@ -21,16 +21,18 @@ module API
# Parameters:
# id (required) - The ID of a project
# ref_name (optional) - The name of a repository branch or tag, if not given the default branch is used
+ # recursive (optional) - Used to get a recursive tree
# Example Request:
# GET /projects/:id/repository/tree
get ':id/repository/tree' do
ref = params[:ref_name] || user_project.try(:default_branch) || 'master'
path = params[:path] || nil
+ recursive = to_boolean(params[:recursive])
commit = user_project.commit(ref)
not_found!('Tree') unless commit
- tree = user_project.repository.tree(commit.id, path)
+ tree = user_project.repository.tree(commit.id, path, recursive: recursive)
present tree.sorted_entries, with: Entities::RepoTreeObject
end