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
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
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
24 additions
and
2 deletions
+24
-2
routable.rb
app/models/concerns/routable.rb
+9
-2
project.rb
app/models/project.rb
+1
-0
routable_spec.rb
spec/models/concerns/routable_spec.rb
+12
-0
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
...
@@ -103,8 +103,11 @@ module Routable
def
full_path
def
full_path
return
uncached_full_path
unless
RequestStore
.
active?
return
uncached_full_path
unless
RequestStore
.
active?
key
=
"routable/full_path/
#{
self
.
class
.
name
}
/
#{
self
.
id
}
"
RequestStore
[
full_path_key
]
||=
uncached_full_path
RequestStore
[
key
]
||=
uncached_full_path
end
def
expires_full_path_cache
RequestStore
.
delete
(
full_path_key
)
if
RequestStore
.
active?
end
end
def
build_full_path
def
build_full_path
...
@@ -135,6 +138,10 @@ module Routable
...
@@ -135,6 +138,10 @@ module Routable
path_changed?
||
parent_changed?
path_changed?
||
parent_changed?
end
end
def
full_path_key
@full_path_key
||=
"routable/full_path/
#{
self
.
class
.
name
}
/
#{
self
.
id
}
"
end
def
build_full_name
def
build_full_name
if
parent
&&
name
if
parent
&&
name
parent
.
human_name
+
' / '
+
name
parent
.
human_name
+
' / '
+
name
...
...
app/models/project.rb
View file @
2446252c
...
@@ -963,6 +963,7 @@ class Project < ActiveRecord::Base
...
@@ -963,6 +963,7 @@ class Project < ActiveRecord::Base
begin
begin
gitlab_shell
.
mv_repository
(
repository_storage_path
,
"
#{
old_path_with_namespace
}
.wiki"
,
"
#{
new_path_with_namespace
}
.wiki"
)
gitlab_shell
.
mv_repository
(
repository_storage_path
,
"
#{
old_path_with_namespace
}
.wiki"
,
"
#{
new_path_with_namespace
}
.wiki"
)
send_move_instructions
(
old_path_with_namespace
)
send_move_instructions
(
old_path_with_namespace
)
expires_full_path_cache
@old_path_with_namespace
=
old_path_with_namespace
@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
...
@@ -132,6 +132,18 @@ describe Group, 'Routable' do
end
end
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
describe
'#full_name'
do
let
(
:group
)
{
create
(
:group
)
}
let
(
:group
)
{
create
(
:group
)
}
let
(
:nested_group
)
{
create
(
:group
,
parent:
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
...
@@ -1216,6 +1216,8 @@ describe Project, models: true do
expect
(
project
).
to
receive
(
:expire_caches_before_rename
)
expect
(
project
).
to
receive
(
:expire_caches_before_rename
)
expect
(
project
).
to
receive
(
:expires_full_path_cache
)
project
.
rename_repo
project
.
rename_repo
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