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
7d629787
Commit
7d629787
authored
Nov 16, 2018
by
Gabriel Mazetto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add `wiki` extra namespace when repository is_wiki: true
parent
2123b789
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
2 deletions
+28
-2
app/models/repository.rb
app/models/repository.rb
+10
-2
spec/models/repository_spec.rb
spec/models/repository_spec.rb
+18
-0
No files found.
app/models/repository.rb
View file @
7d629787
...
...
@@ -1049,11 +1049,19 @@ class Repository
end
def
cache
@cache
||=
Gitlab
::
RepositoryCache
.
new
(
self
)
@cache
||=
if
is_wiki
Gitlab
::
RepositoryCache
.
new
(
self
,
extra_namespace:
'wiki'
)
else
Gitlab
::
RepositoryCache
.
new
(
self
)
end
end
def
request_store_cache
@request_store_cache
||=
Gitlab
::
RepositoryCache
.
new
(
self
,
backend:
Gitlab
::
SafeRequestStore
)
@request_store_cache
||=
if
is_wiki
Gitlab
::
RepositoryCache
.
new
(
self
,
extra_namespace:
'wiki'
,
backend:
Gitlab
::
SafeRequestStore
)
else
Gitlab
::
RepositoryCache
.
new
(
self
,
backend:
Gitlab
::
SafeRequestStore
)
end
end
def
tags_sorted_by_committed_date
...
...
spec/models/repository_spec.rb
View file @
7d629787
...
...
@@ -2403,4 +2403,22 @@ describe Repository do
repository
.
merge_base
(
'master'
,
'fix'
)
end
end
describe
'#cache'
do
subject
(
:cache
)
{
repository
.
send
(
:cache
)
}
it
'returns a RepositoryCache'
do
expect
(
subject
).
to
be_kind_of
Gitlab
::
RepositoryCache
end
it
'when is_wiki it includes wiki as part of key'
do
allow
(
repository
).
to
receive
(
:is_wiki
)
{
true
}
expect
(
subject
.
namespace
).
to
include
(
'wiki'
)
end
it
'when is_wiki is false extra_namespace is nil'
do
expect
(
subject
.
namespace
).
not_to
include
(
'wiki'
)
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