diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-05-17 19:05:49 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-05-17 19:05:49 +0300 |
commit | 43a25d93ebdabea52f99b05e15b06250cd8f07d7 (patch) | |
tree | dceebdc68925362117480a5d672bcff122fb625b /lib/gitlab/gitaly_client | |
parent | 20c84b99005abd1c82101dfeff264ac50d2df211 (diff) |
Add latest changes from gitlab-org/gitlab@16-0-stable-eev16.0.0-rc42
Diffstat (limited to 'lib/gitlab/gitaly_client')
-rw-r--r-- | lib/gitlab/gitaly_client/commit_service.rb | 16 | ||||
-rw-r--r-- | lib/gitlab/gitaly_client/operation_service.rb | 16 | ||||
-rw-r--r-- | lib/gitlab/gitaly_client/ref_service.rb | 6 | ||||
-rw-r--r-- | lib/gitlab/gitaly_client/repository_service.rb | 8 |
4 files changed, 23 insertions, 23 deletions
diff --git a/lib/gitlab/gitaly_client/commit_service.rb b/lib/gitlab/gitaly_client/commit_service.rb index 4df9d800ea6..0c67b9fa078 100644 --- a/lib/gitlab/gitaly_client/commit_service.rb +++ b/lib/gitlab/gitaly_client/commit_service.rb @@ -146,7 +146,6 @@ module Gitlab message.entries.map do |gitaly_tree_entry| Gitlab::Git::Tree.new( id: gitaly_tree_entry.oid, - root_id: gitaly_tree_entry.root_oid, type: gitaly_tree_entry.type.downcase, mode: gitaly_tree_entry.mode.to_s(8), name: File.basename(gitaly_tree_entry.path), @@ -423,7 +422,8 @@ module Gitlab first_parent: !!options[:first_parent], global_options: parse_global_options!(options), disable_walk: true, # This option is deprecated. The 'walk' implementation is being removed. - trailers: options[:trailers] + trailers: options[:trailers], + include_referenced_by: options[:include_referenced_by] ) request.after = GitalyClient.timestamp(options[:after]) if options[:after] request.before = GitalyClient.timestamp(options[:before]) if options[:before] @@ -441,14 +441,14 @@ module Gitlab # revision exists, or `false` otherwise. This function accepts all revisions as specified by # gitrevisions(1). def object_existence_map(revisions, gitaly_repo: @gitaly_repo) + return {} unless revisions.present? + enum = Enumerator.new do |y| - # This is a bug in Gitaly: revisions of the initial request are ignored. This will be fixed in v15.0 via - # https://gitlab.com/gitlab-org/gitaly/-/merge_requests/4510, so we can merge initial request and the initial - # set of revisions starting with v15.1. - y.yield Gitaly::CheckObjectsExistRequest.new(repository: gitaly_repo) + revisions.each_slice(100).with_index do |revisions_subset, i| + params = { revisions: revisions_subset } + params[:repository] = gitaly_repo if i == 0 - revisions.each_slice(100) do |revisions_subset| - y.yield Gitaly::CheckObjectsExistRequest.new(revisions: revisions_subset) + y.yield Gitaly::CheckObjectsExistRequest.new(**params) end end diff --git a/lib/gitlab/gitaly_client/operation_service.rb b/lib/gitlab/gitaly_client/operation_service.rb index 313334737c0..1af06cc7490 100644 --- a/lib/gitlab/gitaly_client/operation_service.rb +++ b/lib/gitlab/gitaly_client/operation_service.rb @@ -45,7 +45,7 @@ module Gitlab rescue GRPC::BadStatus => e detailed_error = GitalyClient.decode_detailed_error(e) - case detailed_error&.error + case detailed_error.try(:error) when :access_check access_check_error = detailed_error.access_check # These messages were returned from internal/allowed API calls @@ -82,7 +82,7 @@ module Gitlab rescue GRPC::BadStatus => e detailed_error = GitalyClient.decode_detailed_error(e) - case detailed_error&.error + case detailed_error.try(:error) when :custom_hook raise Gitlab::Git::PreReceiveError.new(custom_hook_error_message(detailed_error.custom_hook), fallback_message: e.details) @@ -124,7 +124,7 @@ module Gitlab rescue GRPC::BadStatus => e detailed_error = GitalyClient.decode_detailed_error(e) - case detailed_error&.error + case detailed_error.try(:error) when :custom_hook raise Gitlab::Git::PreReceiveError.new(custom_hook_error_message(detailed_error.custom_hook), fallback_message: e.details) @@ -188,7 +188,7 @@ module Gitlab rescue GRPC::BadStatus => e detailed_error = GitalyClient.decode_detailed_error(e) - case detailed_error&.error + case detailed_error.try(:error) when :access_check access_check_error = detailed_error.access_check # These messages were returned from internal/allowed API calls @@ -247,7 +247,7 @@ module Gitlab rescue GRPC::BadStatus => e detailed_error = GitalyClient.decode_detailed_error(e) - case detailed_error&.error + case detailed_error.try(:error) when :access_check access_check_error = detailed_error.access_check # These messages were returned from internal/allowed API calls @@ -329,7 +329,7 @@ module Gitlab rescue GRPC::BadStatus => e detailed_error = GitalyClient.decode_detailed_error(e) - case detailed_error&.error + case detailed_error.try(:error) when :access_check access_check_error = detailed_error.access_check # These messages were returned from internal/allowed API calls @@ -366,7 +366,7 @@ module Gitlab rescue GRPC::BadStatus => e detailed_error = GitalyClient.decode_detailed_error(e) - case detailed_error&.error + case detailed_error.try(:error) when :resolve_revision, :rebase_conflict # Theoretically, we could now raise specific errors based on the type # of the detailed error. Most importantly, we get error details when @@ -458,7 +458,7 @@ module Gitlab rescue GRPC::BadStatus => e detailed_error = GitalyClient.decode_detailed_error(e) - case detailed_error&.error + case detailed_error.try(:error) when :access_check access_check_error = detailed_error.access_check # These messages were returned from internal/allowed API calls diff --git a/lib/gitlab/gitaly_client/ref_service.rb b/lib/gitlab/gitaly_client/ref_service.rb index ac6491e8770..88c79eb8954 100644 --- a/lib/gitlab/gitaly_client/ref_service.rb +++ b/lib/gitlab/gitaly_client/ref_service.rb @@ -113,7 +113,7 @@ module Gitlab rescue GRPC::BadStatus => e detailed_error = GitalyClient.decode_detailed_error(e) - case detailed_error&.error + case detailed_error.try(:error) when :tag_not_found raise Gitlab::Git::UnknownRef, "tag does not exist: #{tag_name}" else @@ -135,7 +135,7 @@ module Gitlab rescue GRPC::BadStatus => e detailed_error = GitalyClient.decode_detailed_error(e) - case detailed_error&.error + case detailed_error.try(:error) when :invalid_format raise Gitlab::Git::InvalidRefFormatError, "references have an invalid format: #{detailed_error.invalid_format.refs.join(",")}" when :references_locked @@ -239,7 +239,7 @@ module Gitlab sort_by = 'name' if sort_by == 'name_asc' enum_value = Gitaly::FindLocalBranchesRequest::SortBy.resolve(sort_by.upcase.to_sym) - raise ArgumentError, "Invalid sort_by key `#{sort_by}`" unless enum_value + return Gitaly::FindLocalBranchesRequest::SortBy::NAME unless enum_value enum_value end diff --git a/lib/gitlab/gitaly_client/repository_service.rb b/lib/gitlab/gitaly_client/repository_service.rb index bcc03ca08c9..93d58710b0c 100644 --- a/lib/gitlab/gitaly_client/repository_service.rb +++ b/lib/gitlab/gitaly_client/repository_service.rb @@ -109,7 +109,7 @@ module Gitlab # rubocop: enable Metrics/ParameterLists def create_repository(default_branch = nil) - request = Gitaly::CreateRepositoryRequest.new(repository: @gitaly_repo, default_branch: default_branch) + request = Gitaly::CreateRepositoryRequest.new(repository: @gitaly_repo, default_branch: encode_binary(default_branch)) gitaly_client_call(@storage, :repository_service, :create_repository, request, timeout: GitalyClient.fast_timeout) end @@ -306,18 +306,18 @@ module Gitlab end def search_files_by_name(ref, query, limit: 0, offset: 0) - request = Gitaly::SearchFilesByNameRequest.new(repository: @gitaly_repo, ref: ref, query: query, limit: limit, offset: offset) + request = Gitaly::SearchFilesByNameRequest.new(repository: @gitaly_repo, ref: encode_binary(ref), query: query, limit: limit, offset: offset) gitaly_client_call(@storage, :repository_service, :search_files_by_name, request, timeout: GitalyClient.fast_timeout).flat_map(&:files) end def search_files_by_content(ref, query, options = {}) - request = Gitaly::SearchFilesByContentRequest.new(repository: @gitaly_repo, ref: ref, query: query) + request = Gitaly::SearchFilesByContentRequest.new(repository: @gitaly_repo, ref: encode_binary(ref), query: query) response = gitaly_client_call(@storage, :repository_service, :search_files_by_content, request, timeout: GitalyClient.default_timeout) search_results_from_response(response, options) end def search_files_by_regexp(ref, filter, limit: 0, offset: 0) - request = Gitaly::SearchFilesByNameRequest.new(repository: @gitaly_repo, ref: ref, query: '.', filter: filter, limit: limit, offset: offset) + request = Gitaly::SearchFilesByNameRequest.new(repository: @gitaly_repo, ref: encode_binary(ref), query: '.', filter: filter, limit: limit, offset: offset) gitaly_client_call(@storage, :repository_service, :search_files_by_name, request, timeout: GitalyClient.fast_timeout).flat_map(&:files) end |