Commit bf02f772 authored by Sean McGivern's avatar Sean McGivern

Merge branch 'zj-remove-extract-commit-signature' into 'master'

Remove ExtractCommitSignature RPC

See merge request gitlab-org/gitlab!18804
parents eadc9738 2168dac3
...@@ -155,10 +155,6 @@ module Gitlab ...@@ -155,10 +155,6 @@ module Gitlab
end end
end end
def extract_signature(repository, commit_id)
repository.gitaly_commit_client.extract_signature(commit_id)
end
def extract_signature_lazily(repository, commit_id) def extract_signature_lazily(repository, commit_id)
BatchLoader.for(commit_id).batch(key: repository) do |commit_ids, loader, args| BatchLoader.for(commit_id).batch(key: repository) do |commit_ids, loader, args|
batch_signature_extraction(args[:key], commit_ids).each do |commit_id, signature_data| batch_signature_extraction(args[:key], commit_ids).each do |commit_id, signature_data|
......
...@@ -348,25 +348,6 @@ module Gitlab ...@@ -348,25 +348,6 @@ module Gitlab
end end
end end
def extract_signature(commit_id)
request = Gitaly::ExtractCommitSignatureRequest.new(repository: @gitaly_repo, commit_id: commit_id)
response = GitalyClient.call(@repository.storage, :commit_service, :extract_commit_signature, request, timeout: GitalyClient.fast_timeout)
signature = +''.b
signed_text = +''.b
response.each do |message|
signature << message.signature
signed_text << message.signed_text
end
return if signature.blank? && signed_text.blank?
[signature, signed_text]
rescue GRPC::InvalidArgument => ex
raise ArgumentError, ex
end
def get_commit_signatures(commit_ids) def get_commit_signatures(commit_ids)
request = Gitaly::GetCommitSignaturesRequest.new(repository: @gitaly_repo, commit_ids: commit_ids) request = Gitaly::GetCommitSignaturesRequest.new(repository: @gitaly_repo, commit_ids: commit_ids)
response = GitalyClient.call(@repository.storage, :commit_service, :get_commit_signatures, request, timeout: GitalyClient.fast_timeout) response = GitalyClient.call(@repository.storage, :commit_service, :get_commit_signatures, request, timeout: GitalyClient.fast_timeout)
......
...@@ -428,7 +428,9 @@ describe Gitlab::Git::Commit, :seed_helper do ...@@ -428,7 +428,9 @@ describe Gitlab::Git::Commit, :seed_helper do
end end
end end
shared_examples 'extracting commit signature' do describe '.extract_signature_lazily' do
subject { described_class.extract_signature_lazily(repository, commit_id).itself }
context 'when the commit is signed' do context 'when the commit is signed' do
let(:commit_id) { '0b4bc9a49b562e85de7cc9e834518ea6828729b9' } let(:commit_id) { '0b4bc9a49b562e85de7cc9e834518ea6828729b9' }
...@@ -492,10 +494,8 @@ describe Gitlab::Git::Commit, :seed_helper do ...@@ -492,10 +494,8 @@ describe Gitlab::Git::Commit, :seed_helper do
expect { subject }.to raise_error(ArgumentError) expect { subject }.to raise_error(ArgumentError)
end end
end end
end
describe '.extract_signature_lazily' do context 'when loading signatures in batch once' do
describe 'loading signatures in batch once' do
it 'fetches signatures in batch once' do it 'fetches signatures in batch once' do
commit_ids = %w[0b4bc9a49b562e85de7cc9e834518ea6828729b9 4b4918a572fa86f9771e5ba40fbd48e1eb03e2c6] commit_ids = %w[0b4bc9a49b562e85de7cc9e834518ea6828729b9 4b4918a572fa86f9771e5ba40fbd48e1eb03e2c6]
signatures = commit_ids.map do |commit_id| signatures = commit_ids.map do |commit_id|
...@@ -516,16 +516,6 @@ describe Gitlab::Git::Commit, :seed_helper do ...@@ -516,16 +516,6 @@ describe Gitlab::Git::Commit, :seed_helper do
2.times { signatures.each(&:itself) } 2.times { signatures.each(&:itself) }
end end
end end
subject { described_class.extract_signature_lazily(repository, commit_id).itself }
it_behaves_like 'extracting commit signature'
end
describe '.extract_signature' do
subject { described_class.extract_signature(repository, commit_id) }
it_behaves_like 'extracting commit signature'
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment