diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-09-15 12:09:47 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-09-15 12:09:47 +0300 |
commit | 33f96e8df089c2291010598c50ec6868ab8cb1ef (patch) | |
tree | 1c9276a56a62e464fc68fa58780647c93f0045cf /lib/gitlab | |
parent | 034e7d969a591605267c0e5ddbe6f2228bf8e43d (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/gitlab')
-rw-r--r-- | lib/gitlab/git/repository.rb | 11 | ||||
-rw-r--r-- | lib/gitlab/gitaly_client/ref_service.rb | 15 | ||||
-rw-r--r-- | lib/gitlab/signed_tag.rb | 24 |
3 files changed, 23 insertions, 27 deletions
diff --git a/lib/gitlab/git/repository.rb b/lib/gitlab/git/repository.rb index 4e588ee9db8..bc15bd367d8 100644 --- a/lib/gitlab/git/repository.rb +++ b/lib/gitlab/git/repository.rb @@ -127,6 +127,13 @@ module Gitlab end end + def find_tag(name) + wrapped_gitaly_errors do + gitaly_ref_client.find_tag(name) + end + rescue CommandError + end + def local_branches(sort_by: nil, pagination_params: nil) wrapped_gitaly_errors do gitaly_ref_client.local_branches(sort_by: sort_by, pagination_params: pagination_params) @@ -604,10 +611,6 @@ module Gitlab end end - def find_tag(name) - tags.find { |tag| tag.name == name } - end - def merge_to_ref(user, **kwargs) wrapped_gitaly_errors do gitaly_operation_client.user_merge_to_ref(user, **kwargs) diff --git a/lib/gitlab/gitaly_client/ref_service.rb b/lib/gitlab/gitaly_client/ref_service.rb index 6ba68a92dcd..2dafe0e12ba 100644 --- a/lib/gitlab/gitaly_client/ref_service.rb +++ b/lib/gitlab/gitaly_client/ref_service.rb @@ -129,6 +129,21 @@ module Gitlab Gitlab::Git::Branch.new(@repository, encode!(branch.name.dup), branch.target_commit.id, target_commit) end + def find_tag(tag_name) + return if tag_name.blank? + + request = Gitaly::FindTagRequest.new( + repository: @gitaly_repo, + tag_name: encode_binary(tag_name) + ) + + response = GitalyClient.call(@repository.storage, :ref_service, :find_tag, request, timeout: GitalyClient.medium_timeout) + tag = response.tag + return unless tag + + Gitlab::Git::Tag.new(@repository, tag) + end + def delete_refs(refs: [], except_with_prefixes: []) request = Gitaly::DeleteRefsRequest.new( repository: @gitaly_repo, diff --git a/lib/gitlab/signed_tag.rb b/lib/gitlab/signed_tag.rb index 3b22cb7622d..49194300a39 100644 --- a/lib/gitlab/signed_tag.rb +++ b/lib/gitlab/signed_tag.rb @@ -7,12 +7,7 @@ module Gitlab def initialize(repository, tag) @repository = repository @tag = tag - - if Feature.enabled?(:get_tag_signatures) - @signature_data = Gitlab::Git::Tag.extract_signature_lazily(repository, tag.id) if repository - else - @signature_data = [signature_text_of_message.b, signed_text_of_message.b] - end + @signature_data = Gitlab::Git::Tag.extract_signature_lazily(repository, tag.id) if repository end def signature @@ -26,22 +21,5 @@ module Gitlab def signed_text @signature_data&.fetch(1) end - - private - - def signature_text_of_message - @tag.message.slice(@tag.message.index("-----BEGIN SIGNED MESSAGE-----")..-1) - rescue StandardError - nil - end - - def signed_text_of_message - %{object #{@tag.target_commit.id} -type commit -tag #{@tag.name} -tagger #{@tag.tagger.name} <#{@tag.tagger.email}> #{@tag.tagger.date.seconds} #{@tag.tagger.timezone} - -#{@tag.message.gsub(/-----BEGIN SIGNED MESSAGE-----(.*)-----END SIGNED MESSAGE-----/m, "")}} - end end end |