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
2446252c
Commit
2446252c
authored
Jun 29, 2017
by
Douglas Barbosa Alexandre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Expires full_path cache after project is renamed
parent
37011af0
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
24 additions
and
2 deletions
+24
-2
app/models/concerns/routable.rb
app/models/concerns/routable.rb
+9
-2
app/models/project.rb
app/models/project.rb
+1
-0
spec/models/concerns/routable_spec.rb
spec/models/concerns/routable_spec.rb
+12
-0
spec/models/project_spec.rb
spec/models/project_spec.rb
+2
-0
No files found.
app/models/concerns/routable.rb
View file @
2446252c
...
...
@@ -103,8 +103,11 @@ module Routable
def
full_path
return
uncached_full_path
unless
RequestStore
.
active?
key
=
"routable/full_path/
#{
self
.
class
.
name
}
/
#{
self
.
id
}
"
RequestStore
[
key
]
||=
uncached_full_path
RequestStore
[
full_path_key
]
||=
uncached_full_path
end
def
expires_full_path_cache
RequestStore
.
delete
(
full_path_key
)
if
RequestStore
.
active?
end
def
build_full_path
...
...
@@ -135,6 +138,10 @@ module Routable
path_changed?
||
parent_changed?
end
def
full_path_key
@full_path_key
||=
"routable/full_path/
#{
self
.
class
.
name
}
/
#{
self
.
id
}
"
end
def
build_full_name
if
parent
&&
name
parent
.
human_name
+
' / '
+
name
...
...
app/models/project.rb
View file @
2446252c
...
...
@@ -963,6 +963,7 @@ class Project < ActiveRecord::Base
begin
gitlab_shell
.
mv_repository
(
repository_storage_path
,
"
#{
old_path_with_namespace
}
.wiki"
,
"
#{
new_path_with_namespace
}
.wiki"
)
send_move_instructions
(
old_path_with_namespace
)
expires_full_path_cache
@old_path_with_namespace
=
old_path_with_namespace
...
...
spec/models/concerns/routable_spec.rb
View file @
2446252c
...
...
@@ -132,6 +132,18 @@ describe Group, 'Routable' do
end
end
describe
'#expires_full_path_cache'
do
context
'with RequestStore active'
,
:request_store
do
it
'expires the full_path cache'
do
expect
(
group
).
to
receive
(
:uncached_full_path
).
twice
.
and_call_original
3
.
times
{
group
.
full_path
}
group
.
expires_full_path_cache
3
.
times
{
group
.
full_path
}
end
end
end
describe
'#full_name'
do
let
(
:group
)
{
create
(
:group
)
}
let
(
:nested_group
)
{
create
(
:group
,
parent:
group
)
}
...
...
spec/models/project_spec.rb
View file @
2446252c
...
...
@@ -1216,6 +1216,8 @@ describe Project, models: true do
expect
(
project
).
to
receive
(
:expire_caches_before_rename
)
expect
(
project
).
to
receive
(
:expires_full_path_cache
)
project
.
rename_repo
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