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
306d0661
Commit
306d0661
authored
Aug 25, 2016
by
Yorick Peterse
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'project_avatar_default_branch' into 'master'
Display project icon from the default branch instead of master See merge request !5792
parents
0111b279
f16eabfc
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
35 additions
and
2 deletions
+35
-2
CHANGELOG
CHANGELOG
+1
-0
avatars_controller.rb
app/controllers/projects/avatars_controller.rb
+1
-1
project.rb
app/models/project.rb
+1
-0
repository.rb
app/models/repository.rb
+1
-1
project_spec.rb
spec/models/project_spec.rb
+31
-0
No files found.
CHANGELOG
View file @
306d0661
...
...
@@ -17,6 +17,7 @@ v 8.11.1 (unreleased)
- Does not halt the GitHub import process when an error occurs
- Fix file links on project page when default view is Files !5933
- Change using size to use count and caching it for number of group members
- Use the default branch for displaying the project icon instead of master !5792 (Hannes Rosenögger)
v 8.11.0
- Use test coverage value from the latest successful pipeline in badge. !5862
...
...
app/controllers/projects/avatars_controller.rb
View file @
306d0661
...
...
@@ -4,7 +4,7 @@ class Projects::AvatarsController < Projects::ApplicationController
before_action
:authorize_admin_project!
,
only:
[
:destroy
]
def
show
@blob
=
@repository
.
blob_at_branch
(
'master'
,
@project
.
avatar_in_git
)
@blob
=
@repository
.
blob_at_branch
(
@repository
.
root_ref
,
@project
.
avatar_in_git
)
if
@blob
headers
[
'X-Content-Type-Options'
]
=
'nosniff'
...
...
app/models/project.rb
View file @
306d0661
...
...
@@ -1035,6 +1035,7 @@ class Project < ActiveRecord::Base
"refs/heads/
#{
branch
}
"
,
force:
true
)
repository
.
copy_gitattributes
(
branch
)
repository
.
expire_avatar_cache
(
branch
)
reload_default_branch
end
...
...
app/models/repository.rb
View file @
306d0661
...
...
@@ -1065,7 +1065,7 @@ class Repository
@avatar
||=
cache
.
fetch
(
:avatar
)
do
AVATAR_FILES
.
find
do
|
file
|
blob_at_branch
(
'master'
,
file
)
blob_at_branch
(
root_ref
,
file
)
end
end
end
...
...
spec/models/project_spec.rb
View file @
306d0661
...
...
@@ -1442,4 +1442,35 @@ describe Project, models: true do
expect
(
shared_project
.
authorized_for_user?
(
master
,
Gitlab
::
Access
::
MASTER
)).
to
be
(
true
)
end
end
describe
'change_head'
do
let
(
:project
)
{
create
(
:project
)
}
it
'calls the before_change_head method'
do
expect
(
project
.
repository
).
to
receive
(
:before_change_head
)
project
.
change_head
(
project
.
default_branch
)
end
it
'creates the new reference with rugged'
do
expect
(
project
.
repository
.
rugged
.
references
).
to
receive
(
:create
).
with
(
'HEAD'
,
"refs/heads/
#{
project
.
default_branch
}
"
,
force:
true
)
project
.
change_head
(
project
.
default_branch
)
end
it
'copies the gitattributes'
do
expect
(
project
.
repository
).
to
receive
(
:copy_gitattributes
).
with
(
project
.
default_branch
)
project
.
change_head
(
project
.
default_branch
)
end
it
'expires the avatar cache'
do
expect
(
project
.
repository
).
to
receive
(
:expire_avatar_cache
).
with
(
project
.
default_branch
)
project
.
change_head
(
project
.
default_branch
)
end
it
'reloads the default branch'
do
expect
(
project
).
to
receive
(
:reload_default_branch
)
project
.
change_head
(
project
.
default_branch
)
end
end
end
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