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
iv
gitlab-ce
Commits
9ae8fb93
Commit
9ae8fb93
authored
Feb 20, 2016
by
Douwe Maan
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'flush-cache-web-editor' into 'master'
Flush emptiness caches whenever needed See merge request !2903
parents
040ae7e3
e0cb3212
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
0 deletions
+18
-0
app/models/repository.rb
app/models/repository.rb
+4
-0
spec/models/repository_spec.rb
spec/models/repository_spec.rb
+14
-0
No files found.
app/models/repository.rb
View file @
9ae8fb93
...
@@ -239,6 +239,10 @@ class Repository
...
@@ -239,6 +239,10 @@ class Repository
end
end
expire_branch_cache
(
branch_name
)
expire_branch_cache
(
branch_name
)
# This ensures this particular cache is flushed after the first commit to a
# new repository.
expire_emptiness_caches
if
empty?
end
end
# Expires _all_ caches, including those that would normally only be expired
# Expires _all_ caches, including those that would normally only be expired
...
...
spec/models/repository_spec.rb
View file @
9ae8fb93
...
@@ -361,6 +361,20 @@ describe Repository, models: true do
...
@@ -361,6 +361,20 @@ describe Repository, models: true do
repository
.
expire_cache
(
'master'
)
repository
.
expire_cache
(
'master'
)
end
end
it
'expires the emptiness cache for an empty repository'
do
expect
(
repository
).
to
receive
(
:empty?
).
and_return
(
true
)
expect
(
repository
).
to
receive
(
:expire_emptiness_caches
)
repository
.
expire_cache
end
it
'does not expire the emptiness cache for a non-empty repository'
do
expect
(
repository
).
to
receive
(
:empty?
).
and_return
(
false
)
expect
(
repository
).
to_not
receive
(
:expire_emptiness_caches
)
repository
.
expire_cache
end
end
end
describe
'#expire_root_ref_cache'
do
describe
'#expire_root_ref_cache'
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