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
fd5f6166
Commit
fd5f6166
authored
Dec 13, 2021
by
Pavel Shutsin
Committed by
Stan Hu
Dec 13, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make Repository#blobs_at safe
parent
717f5497
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
0 deletions
+12
-0
app/models/repository.rb
app/models/repository.rb
+2
-0
spec/models/repository_spec.rb
spec/models/repository_spec.rb
+10
-0
No files found.
app/models/repository.rb
View file @
fd5f6166
...
...
@@ -519,6 +519,8 @@ class Repository
raw_repository
.
batch_blobs
(
items
,
blob_size_limit:
blob_size_limit
).
map
do
|
blob
|
Blob
.
decorate
(
blob
,
container
)
end
rescue
Gitlab
::
Git
::
Repository
::
NoRepository
[]
end
def
root_ref
...
...
spec/models/repository_spec.rb
View file @
fd5f6166
...
...
@@ -1679,6 +1679,16 @@ RSpec.describe Repository do
expect
(
blobs
.
first
.
name
).
to
eq
(
'foobar'
)
expect
(
blobs
.
size
).
to
eq
(
1
)
end
context
'when Gitaly returns NoRepository'
do
before
do
allow
(
repository
.
raw_repository
).
to
receive
(
:batch_blobs
).
and_raise
(
Gitlab
::
Git
::
Repository
::
NoRepository
)
end
it
'returns empty array'
do
expect
(
repository
.
blobs_at
([
%w[master foobar]
])).
to
match_array
([])
end
end
end
describe
'#root_ref'
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