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
2b934a7f
Commit
2b934a7f
authored
Apr 18, 2017
by
Robert Speicher
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dm-git-blob-sizes' into 'master'
Normalize sizes in Gitlab::Git::Blob See merge request !10742
parents
60196e8b
d6f49b85
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
4 deletions
+4
-4
lib/gitlab/git/blob.rb
lib/gitlab/git/blob.rb
+2
-2
spec/lib/gitlab/git/blob_spec.rb
spec/lib/gitlab/git/blob_spec.rb
+2
-2
No files found.
lib/gitlab/git/blob.rb
View file @
2b934a7f
...
@@ -8,7 +8,7 @@ module Gitlab
...
@@ -8,7 +8,7 @@ module Gitlab
# the user. We load as much as we can for encoding detection
# the user. We load as much as we can for encoding detection
# (Linguist) and LFS pointer parsing. All other cases where we need full
# (Linguist) and LFS pointer parsing. All other cases where we need full
# blob data should use load_all_data!.
# blob data should use load_all_data!.
MAX_DATA_DISPLAY_SIZE
=
10
485760
MAX_DATA_DISPLAY_SIZE
=
10
.
megabytes
attr_accessor
:name
,
:path
,
:size
,
:data
,
:mode
,
:id
,
:commit_id
,
:loaded_size
,
:binary
attr_accessor
:name
,
:path
,
:size
,
:data
,
:mode
,
:id
,
:commit_id
,
:loaded_size
,
:binary
...
@@ -153,7 +153,7 @@ module Gitlab
...
@@ -153,7 +153,7 @@ module Gitlab
def
lfs_size
def
lfs_size
if
has_lfs_version_key?
if
has_lfs_version_key?
size
=
data
.
match
(
/(?<=size )([0-9]+)/
)
size
=
data
.
match
(
/(?<=size )([0-9]+)/
)
return
size
[
1
]
if
size
return
size
[
1
]
.
to_i
if
size
end
end
nil
nil
...
...
spec/lib/gitlab/git/blob_spec.rb
View file @
2b934a7f
...
@@ -234,7 +234,7 @@ describe Gitlab::Git::Blob, seed_helper: true do
...
@@ -234,7 +234,7 @@ describe Gitlab::Git::Blob, seed_helper: true do
it
{
expect
(
blob
.
lfs_pointer?
).
to
eq
(
true
)
}
it
{
expect
(
blob
.
lfs_pointer?
).
to
eq
(
true
)
}
it
{
expect
(
blob
.
lfs_oid
).
to
eq
(
"4206f951d2691c78aac4c0ce9f2b23580b2c92cdcc4336e1028742c0274938e0"
)
}
it
{
expect
(
blob
.
lfs_oid
).
to
eq
(
"4206f951d2691c78aac4c0ce9f2b23580b2c92cdcc4336e1028742c0274938e0"
)
}
it
{
expect
(
blob
.
lfs_size
).
to
eq
(
"19548"
)
}
it
{
expect
(
blob
.
lfs_size
).
to
eq
(
19548
)
}
it
{
expect
(
blob
.
id
).
to
eq
(
"f4d76af13003d1106be7ac8c5a2a3d37ddf32c2a"
)
}
it
{
expect
(
blob
.
id
).
to
eq
(
"f4d76af13003d1106be7ac8c5a2a3d37ddf32c2a"
)
}
it
{
expect
(
blob
.
name
).
to
eq
(
"image.jpg"
)
}
it
{
expect
(
blob
.
name
).
to
eq
(
"image.jpg"
)
}
it
{
expect
(
blob
.
path
).
to
eq
(
"files/lfs/image.jpg"
)
}
it
{
expect
(
blob
.
path
).
to
eq
(
"files/lfs/image.jpg"
)
}
...
@@ -273,7 +273,7 @@ describe Gitlab::Git::Blob, seed_helper: true do
...
@@ -273,7 +273,7 @@ describe Gitlab::Git::Blob, seed_helper: true do
it
{
expect
(
blob
.
lfs_pointer?
).
to
eq
(
false
)
}
it
{
expect
(
blob
.
lfs_pointer?
).
to
eq
(
false
)
}
it
{
expect
(
blob
.
lfs_oid
).
to
eq
(
nil
)
}
it
{
expect
(
blob
.
lfs_oid
).
to
eq
(
nil
)
}
it
{
expect
(
blob
.
lfs_size
).
to
eq
(
"1575078"
)
}
it
{
expect
(
blob
.
lfs_size
).
to
eq
(
1575078
)
}
it
{
expect
(
blob
.
id
).
to
eq
(
"5ae35296e1f95c1ef9feda1241477ed29a448572"
)
}
it
{
expect
(
blob
.
id
).
to
eq
(
"5ae35296e1f95c1ef9feda1241477ed29a448572"
)
}
it
{
expect
(
blob
.
name
).
to
eq
(
"picture-invalid.png"
)
}
it
{
expect
(
blob
.
name
).
to
eq
(
"picture-invalid.png"
)
}
it
{
expect
(
blob
.
path
).
to
eq
(
"files/lfs/picture-invalid.png"
)
}
it
{
expect
(
blob
.
path
).
to
eq
(
"files/lfs/picture-invalid.png"
)
}
...
...
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