Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
07b0beb0
Commit
07b0beb0
authored
Jan 25, 2018
by
Ahmad Sherif
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix .batch_lfs_pointers accepting a lazy enumerator
parent
944c1eb6
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
3 deletions
+18
-3
lib/gitlab/git/blob.rb
lib/gitlab/git/blob.rb
+1
-3
lib/gitlab/gitaly_client/blob_service.rb
lib/gitlab/gitaly_client/blob_service.rb
+2
-0
spec/lib/gitlab/git/blob_spec.rb
spec/lib/gitlab/git/blob_spec.rb
+15
-0
No files found.
lib/gitlab/git/blob.rb
View file @
07b0beb0
...
...
@@ -70,11 +70,9 @@ module Gitlab
# Returns array of Gitlab::Git::Blob
# Does not guarantee blob data will be set
def
batch_lfs_pointers
(
repository
,
blob_ids
)
return
[]
if
blob_ids
.
empty?
repository
.
gitaly_migrate
(
:batch_lfs_pointers
)
do
|
is_enabled
|
if
is_enabled
repository
.
gitaly_blob_client
.
batch_lfs_pointers
(
blob_ids
)
repository
.
gitaly_blob_client
.
batch_lfs_pointers
(
blob_ids
.
to_a
)
else
blob_ids
.
lazy
.
select
{
|
sha
|
possible_lfs_blob?
(
repository
,
sha
)
}
...
...
lib/gitlab/gitaly_client/blob_service.rb
View file @
07b0beb0
...
...
@@ -34,6 +34,8 @@ module Gitlab
end
def
batch_lfs_pointers
(
blob_ids
)
return
[]
if
blob_ids
.
empty?
request
=
Gitaly
::
GetLFSPointersRequest
.
new
(
repository:
@gitaly_repo
,
blob_ids:
blob_ids
...
...
spec/lib/gitlab/git/blob_spec.rb
View file @
07b0beb0
...
...
@@ -268,6 +268,21 @@ describe Gitlab::Git::Blob, seed_helper: true do
expect
(
blobs
).
to
all
(
be_a
(
Gitlab
::
Git
::
Blob
)
)
end
it
'accepts blob IDs as a lazy enumerator'
do
blobs
=
described_class
.
batch_lfs_pointers
(
repository
,
[
lfs_blob
.
id
].
lazy
)
expect
(
blobs
.
count
).
to
eq
(
1
)
expect
(
blobs
).
to
all
(
be_a
(
Gitlab
::
Git
::
Blob
)
)
end
it
'handles empty list of IDs gracefully'
do
blobs_1
=
described_class
.
batch_lfs_pointers
(
repository
,
[].
lazy
)
blobs_2
=
described_class
.
batch_lfs_pointers
(
repository
,
[])
expect
(
blobs_1
).
to
eq
([])
expect
(
blobs_2
).
to
eq
([])
end
it
'silently ignores tree objects'
do
blobs
=
described_class
.
batch_lfs_pointers
(
repository
,
[
tree_object
.
oid
])
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment