BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
408c5952
Commit
408c5952
authored
Sep 22, 2017
by
Douwe Maan
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'sh-blob-raw-check' into 'master'
Ensure that Blob.raw returns always returns a valid blob object See merge request gitlab-org/gitlab-ce!14412
parents
41068df7
794b4c55
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
0 deletions
+5
-0
blob.rb
lib/gitlab/git/blob.rb
+2
-0
blob_spec.rb
spec/lib/gitlab/git/blob_spec.rb
+3
-0
No files found.
lib/gitlab/git/blob.rb
View file @
408c5952
...
...
@@ -32,6 +32,8 @@ module Gitlab
else
blob
=
repository
.
lookup
(
sha
)
next
unless
blob
.
is_a?
(
Rugged
::
Blob
)
new
(
id:
blob
.
oid
,
size:
blob
.
size
,
...
...
spec/lib/gitlab/git/blob_spec.rb
View file @
408c5952
...
...
@@ -119,10 +119,13 @@ describe Gitlab::Git::Blob, seed_helper: true do
shared_examples
'finding blobs by ID'
do
let
(
:raw_blob
)
{
Gitlab
::
Git
::
Blob
.
raw
(
repository
,
SeedRepo
::
RubyBlob
::
ID
)
}
let
(
:bad_blob
)
{
Gitlab
::
Git
::
Blob
.
raw
(
repository
,
SeedRepo
::
BigCommit
::
ID
)
}
it
{
expect
(
raw_blob
.
id
).
to
eq
(
SeedRepo
::
RubyBlob
::
ID
)
}
it
{
expect
(
raw_blob
.
data
[
0
..
10
]).
to
eq
(
"require
\'
fi"
)
}
it
{
expect
(
raw_blob
.
size
).
to
eq
(
669
)
}
it
{
expect
(
raw_blob
.
truncated?
).
to
be_falsey
}
it
{
expect
(
bad_blob
).
to
be_nil
}
context
'large file'
do
it
'limits the size of a large file'
do
...
...
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