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
0
Merge Requests
0
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
Boxiang Sun
gitlab-ce
Commits
50687897
Commit
50687897
authored
Mar 24, 2016
by
Stan Hu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Don't attempt to look up an avatar in repo if repo directory does not exist
Closes #14580
parent
63c8a05b
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
15 additions
and
0 deletions
+15
-0
CHANGELOG
CHANGELOG
+1
-0
app/models/repository.rb
app/models/repository.rb
+2
-0
spec/models/project_spec.rb
spec/models/project_spec.rb
+6
-0
spec/models/repository_spec.rb
spec/models/repository_spec.rb
+6
-0
No files found.
CHANGELOG
View file @
50687897
Please view this file on the master branch, on stable branches it's out of date.
Please view this file on the master branch, on stable branches it's out of date.
v 8.7.0 (unreleased)
v 8.7.0 (unreleased)
- Don't attempt to look up an avatar in repo if repo directory does not exist (Stan hu)
- Preserve time notes/comments have been updated at when moving issue
- Preserve time notes/comments have been updated at when moving issue
- Make HTTP(s) label consistent on clone bar (Stan Hu)
- Make HTTP(s) label consistent on clone bar (Stan Hu)
- Fix avatar stretching by providing a cropping feature
- Fix avatar stretching by providing a cropping feature
...
...
app/models/repository.rb
View file @
50687897
...
@@ -877,6 +877,8 @@ class Repository
...
@@ -877,6 +877,8 @@ class Repository
end
end
def
avatar
def
avatar
return
nil
unless
exists?
@avatar
||=
cache
.
fetch
(
:avatar
)
do
@avatar
||=
cache
.
fetch
(
:avatar
)
do
AVATAR_FILES
.
find
do
|
file
|
AVATAR_FILES
.
find
do
|
file
|
blob_at_branch
(
'master'
,
file
)
blob_at_branch
(
'master'
,
file
)
...
...
spec/models/project_spec.rb
View file @
50687897
...
@@ -422,6 +422,12 @@ describe Project, models: true do
...
@@ -422,6 +422,12 @@ describe Project, models: true do
it
{
should
eq
"http://localhost
#{
avatar_path
}
"
}
it
{
should
eq
"http://localhost
#{
avatar_path
}
"
}
end
end
context
'when git repo is empty'
do
let
(
:project
)
{
create
(
:empty_project
)
}
it
{
should
eq
nil
}
end
end
end
describe
:ci_commit
do
describe
:ci_commit
do
...
...
spec/models/repository_spec.rb
View file @
50687897
...
@@ -725,6 +725,12 @@ describe Repository, models: true do
...
@@ -725,6 +725,12 @@ describe Repository, models: true do
end
end
describe
'#avatar'
do
describe
'#avatar'
do
it
'returns nil if repo does not exist'
do
expect
(
repository
).
to
receive
(
:exists?
).
and_return
(
false
)
expect
(
repository
.
avatar
).
to
eq
(
nil
)
end
it
'returns the first avatar file found in the repository'
do
it
'returns the first avatar file found in the repository'
do
expect
(
repository
).
to
receive
(
:blob_at_branch
).
expect
(
repository
).
to
receive
(
:blob_at_branch
).
with
(
'master'
,
'logo.png'
).
with
(
'master'
,
'logo.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