diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-08-26 17:37:09 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-08-26 17:37:20 +0300 |
commit | 25ed7b6ae4712518e96d4719b75dd293c57404a2 (patch) | |
tree | 102e02b15909f27a82b6cf64e7b878f0b201b383 /lib/gitlab/git | |
parent | daf5ae5bd439f1f32363d410129d5b9e73fbb539 (diff) |
Add latest changes from gitlab-org/security/gitlab@15-3-stable-ee
Diffstat (limited to 'lib/gitlab/git')
-rw-r--r-- | lib/gitlab/git/rugged_impl/tree.rb | 9 | ||||
-rw-r--r-- | lib/gitlab/git/tree.rb | 9 |
2 files changed, 10 insertions, 8 deletions
diff --git a/lib/gitlab/git/rugged_impl/tree.rb b/lib/gitlab/git/rugged_impl/tree.rb index bc0af12d7e3..66cfc02130b 100644 --- a/lib/gitlab/git/rugged_impl/tree.rb +++ b/lib/gitlab/git/rugged_impl/tree.rb @@ -16,9 +16,10 @@ module Gitlab TREE_SORT_ORDER = { tree: 0, blob: 1, commit: 2 }.freeze override :tree_entries - def tree_entries(repository, sha, path, recursive, pagination_params = nil) + def tree_entries(repository, sha, path, recursive, skip_flat_paths, pagination_params = nil) if use_rugged?(repository, :rugged_tree_entries) - entries = execute_rugged_call(:tree_entries_with_flat_path_from_rugged, repository, sha, path, recursive) + entries = execute_rugged_call( + :tree_entries_with_flat_path_from_rugged, repository, sha, path, recursive, skip_flat_paths) if pagination_params paginated_response(entries, pagination_params[:limit], pagination_params[:page_token].to_s) @@ -60,11 +61,11 @@ module Gitlab [result, cursor] end - def tree_entries_with_flat_path_from_rugged(repository, sha, path, recursive) + def tree_entries_with_flat_path_from_rugged(repository, sha, path, recursive, skip_flat_paths) tree_entries_from_rugged(repository, sha, path, recursive).tap do |entries| # This was an optimization to reduce N+1 queries for Gitaly # (https://gitlab.com/gitlab-org/gitaly/issues/530). - rugged_populate_flat_path(repository, sha, path, entries) + rugged_populate_flat_path(repository, sha, path, entries) unless skip_flat_paths end end diff --git a/lib/gitlab/git/tree.rb b/lib/gitlab/git/tree.rb index eb008507397..f0eef619e13 100644 --- a/lib/gitlab/git/tree.rb +++ b/lib/gitlab/git/tree.rb @@ -15,15 +15,16 @@ module Gitlab # Uses rugged for raw objects # # Gitaly migration: https://gitlab.com/gitlab-org/gitaly/issues/320 - def where(repository, sha, path = nil, recursive = false, pagination_params = nil) + def where(repository, sha, path = nil, recursive = false, skip_flat_paths = true, pagination_params = nil) path = nil if path == '' || path == '/' - tree_entries(repository, sha, path, recursive, pagination_params) + tree_entries(repository, sha, path, recursive, skip_flat_paths, pagination_params) end - def tree_entries(repository, sha, path, recursive, pagination_params = nil) + def tree_entries(repository, sha, path, recursive, skip_flat_paths, pagination_params = nil) wrapped_gitaly_errors do - repository.gitaly_commit_client.tree_entries(repository, sha, path, recursive, pagination_params) + repository.gitaly_commit_client.tree_entries( + repository, sha, path, recursive, skip_flat_paths, pagination_params) end end |