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
29a1c5a1
Commit
29a1c5a1
authored
Aug 07, 2017
by
Jacob Vosmaer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename 'limit' to 'blob_size_limit'
parent
5e20e448
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
12 deletions
+11
-12
lib/gitlab/git/blob.rb
lib/gitlab/git/blob.rb
+6
-7
spec/lib/gitlab/git/blob_spec.rb
spec/lib/gitlab/git/blob_spec.rb
+5
-5
No files found.
lib/gitlab/git/blob.rb
View file @
29a1c5a1
...
...
@@ -51,18 +51,17 @@ module Gitlab
end
# Returns an array of Blob instances, specified in blob_references as
# [[commit_sha, path], [commit_sha, path], ...]. If limit < 0 then the
# full blob contents are returned. If limit >= 0 then each blob will
# [[commit_sha, path], [commit_sha, path], ...]. If
blob_size_
limit < 0 then the
# full blob contents are returned. If
blob_size_
limit >= 0 then each blob will
# contain no more than limit bytes in its data attribute.
#
# Keep in mind that this method may allocate a lot of memory. It is up
# to the caller to limit the number of blobs and/or the content limit
# for the individual blobs.
# to the caller to limit the number of blobs and blob_size_limit.
#
def
batch
(
repository
,
blob_references
,
limit:
nil
)
limit
||=
MAX_DATA_DISPLAY_SIZE
def
batch
(
repository
,
blob_references
,
blob_size_
limit:
nil
)
blob_size_
limit
||=
MAX_DATA_DISPLAY_SIZE
blob_references
.
map
do
|
sha
,
path
|
find_by_rugged
(
repository
,
sha
,
path
,
limit:
limit
)
find_by_rugged
(
repository
,
sha
,
path
,
limit:
blob_size_
limit
)
end
end
...
...
spec/lib/gitlab/git/blob_spec.rb
View file @
29a1c5a1
...
...
@@ -181,10 +181,10 @@ describe Gitlab::Git::Blob, seed_helper: true do
end
context
'limiting'
do
subject
{
described_class
.
batch
(
repository
,
blob_references
,
limit:
limit
)
}
subject
{
described_class
.
batch
(
repository
,
blob_references
,
blob_size_limit:
blob_size_
limit
)
}
context
'default'
do
let
(
:limit
)
{
nil
}
let
(
:
blob_size_
limit
)
{
nil
}
it
'limits to MAX_DATA_DISPLAY_SIZE'
do
stub_const
(
'Gitlab::Git::Blob::MAX_DATA_DISPLAY_SIZE'
,
100
)
...
...
@@ -194,19 +194,19 @@ describe Gitlab::Git::Blob, seed_helper: true do
end
context
'positive'
do
let
(
:limit
)
{
10
}
let
(
:
blob_size_
limit
)
{
10
}
it
{
expect
(
subject
.
first
.
data
.
size
).
to
eq
(
10
)
}
end
context
'zero'
do
let
(
:limit
)
{
0
}
let
(
:
blob_size_
limit
)
{
0
}
it
{
expect
(
subject
.
first
.
data
).
to
eq
(
''
)
}
end
context
'negative'
do
let
(
:limit
)
{
-
1
}
let
(
:
blob_size_
limit
)
{
-
1
}
it
'ignores MAX_DATA_DISPLAY_SIZE'
do
stub_const
(
'Gitlab::Git::Blob::MAX_DATA_DISPLAY_SIZE'
,
100
)
...
...
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