summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2019-05-20 11:41:50 -0700
committerStan Hu <stanhu@gmail.com>2019-05-20 11:44:39 -0700
commitc6bc4a24eee5b48a840e5f72236b06b04fe53954 (patch)
treeaea17339c7cf682490cb80001a4e773410b6d814
parentcddf9b875a25814e20f3209f04c00c95847f38c2 (diff)
downloadgitlab-ce-sh-fix-rugged-get-tree-entries-recursive.tar.gz
API: Fix recursive flag not working with Rugged get_tree_entries flagsh-fix-rugged-get-tree-entries-recursive
Attempting to use the API endpoint /projects/:id/repository/tree?recursive=true would only return a subset of the results since the full recursive list wasn't actually being returned. Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/61979
-rw-r--r--changelogs/unreleased/sh-fix-rugged-get-tree-entries-recursive.yml5
-rw-r--r--lib/gitlab/git/rugged_impl/tree.rb2
-rw-r--r--spec/lib/gitlab/git/tree_spec.rb4
3 files changed, 10 insertions, 1 deletions
diff --git a/changelogs/unreleased/sh-fix-rugged-get-tree-entries-recursive.yml b/changelogs/unreleased/sh-fix-rugged-get-tree-entries-recursive.yml
new file mode 100644
index 00000000000..a9d46c6f460
--- /dev/null
+++ b/changelogs/unreleased/sh-fix-rugged-get-tree-entries-recursive.yml
@@ -0,0 +1,5 @@
+---
+title: Fix Rugged get_tree_entries recursive flag not working
+merge_request: 28494
+author:
+type: fixed
diff --git a/lib/gitlab/git/rugged_impl/tree.rb b/lib/gitlab/git/rugged_impl/tree.rb
index bb13d114d46..9c37bb01961 100644
--- a/lib/gitlab/git/rugged_impl/tree.rb
+++ b/lib/gitlab/git/rugged_impl/tree.rb
@@ -43,6 +43,8 @@ module Gitlab
ordered_entries.concat(tree_entries_from_rugged(repository, sha, entry.path, true))
end
end
+
+ ordered_entries
end
def rugged_populate_flat_path(repository, sha, path, entries)
diff --git a/spec/lib/gitlab/git/tree_spec.rb b/spec/lib/gitlab/git/tree_spec.rb
index 7ad3cde97f8..7e169cfe270 100644
--- a/spec/lib/gitlab/git/tree_spec.rb
+++ b/spec/lib/gitlab/git/tree_spec.rb
@@ -19,7 +19,9 @@ describe Gitlab::Git::Tree, :seed_helper do
it 'returns a list of tree objects' do
entries = described_class.where(repository, SeedRepo::Commit::ID, 'files', true)
- expect(entries.count).to be >= 5
+ expect(entries.map(&:path)).to include('files/html',
+ 'files/markdown/ruby-style-guide.md')
+ expect(entries.count).to be >= 10
expect(entries).to all(be_a(Gitlab::Git::Tree))
end