Commit a2581af6 authored by Heinrich Lee Yu's avatar Heinrich Lee Yu

Merge branch 'refactor-around-get-all_lfs_pointer' into 'master'

Fix code around GetAllLFSPointersRequest

See merge request gitlab-org/gitlab!27830
parents 6be2c3a9 b20e55f5
...@@ -15,7 +15,7 @@ describe Gitlab::Cleanup::OrphanLfsFileReferences do ...@@ -15,7 +15,7 @@ describe Gitlab::Cleanup::OrphanLfsFileReferences do
allow(Gitlab.config.lfs).to receive(:enabled).and_return(true) allow(Gitlab.config.lfs).to receive(:enabled).and_return(true)
# Create a valid reference # Create a valid reference
oid = project.repository.gitaly_blob_client.get_all_lfs_pointers(nil).first.lfs_oid oid = project.repository.gitaly_blob_client.get_all_lfs_pointers.first.lfs_oid
lfs_object2 = create(:lfs_object, oid: oid) lfs_object2 = create(:lfs_object, oid: oid)
create(:lfs_objects_project, project: project, lfs_object: lfs_object2) create(:lfs_objects_project, project: project, lfs_object: lfs_object2)
end end
......
...@@ -40,7 +40,7 @@ module Gitlab ...@@ -40,7 +40,7 @@ module Gitlab
end end
def lfs_oids_from_repository def lfs_oids_from_repository
project.repository.gitaly_blob_client.get_all_lfs_pointers(nil).map(&:lfs_oid) project.repository.gitaly_blob_client.get_all_lfs_pointers.map(&:lfs_oid)
end end
def orphan_oids def orphan_oids
......
...@@ -13,7 +13,7 @@ module Gitlab ...@@ -13,7 +13,7 @@ module Gitlab
end end
def all_pointers def all_pointers
@repository.gitaly_blob_client.get_all_lfs_pointers(@newrev) @repository.gitaly_blob_client.get_all_lfs_pointers
end end
end end
end end
......
...@@ -131,10 +131,9 @@ module Gitlab ...@@ -131,10 +131,9 @@ module Gitlab
map_lfs_pointers(response) map_lfs_pointers(response)
end end
def get_all_lfs_pointers(revision) def get_all_lfs_pointers
request = Gitaly::GetNewLFSPointersRequest.new( request = Gitaly::GetAllLFSPointersRequest.new(
repository: @gitaly_repo, repository: @gitaly_repo
revision: encode_binary(revision)
) )
response = GitalyClient.call(@gitaly_repo.storage_name, :blob_service, :get_all_lfs_pointers, request, timeout: GitalyClient.medium_timeout) response = GitalyClient.call(@gitaly_repo.storage_name, :blob_service, :get_all_lfs_pointers, request, timeout: GitalyClient.medium_timeout)
......
...@@ -46,14 +46,12 @@ describe Gitlab::GitalyClient::BlobService do ...@@ -46,14 +46,12 @@ describe Gitlab::GitalyClient::BlobService do
end end
describe '#get_all_lfs_pointers' do describe '#get_all_lfs_pointers' do
let(:revision) { 'master' } subject { client.get_all_lfs_pointers }
subject { client.get_all_lfs_pointers(revision) }
it 'sends a get_all_lfs_pointers message' do it 'sends a get_all_lfs_pointers message' do
expect_any_instance_of(Gitaly::BlobService::Stub) expect_any_instance_of(Gitaly::BlobService::Stub)
.to receive(:get_all_lfs_pointers) .to receive(:get_all_lfs_pointers)
.with(gitaly_request_with_params(revision: revision), kind_of(Hash)) .with(gitaly_request_with_params({}), kind_of(Hash))
.and_return([]) .and_return([])
subject subject
......
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