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
Jérome Perrin
gitlab-ce
Commits
ca089f59
Commit
ca089f59
authored
Dec 19, 2017
by
Douglas Barbosa Alexandre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update project full path in .git/config when renaming namespace
parent
bd903307
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
0 deletions
+23
-0
app/models/concerns/storage/legacy_namespace.rb
app/models/concerns/storage/legacy_namespace.rb
+2
-0
app/models/namespace.rb
app/models/namespace.rb
+7
-0
spec/models/namespace_spec.rb
spec/models/namespace_spec.rb
+14
-0
No files found.
app/models/concerns/storage/legacy_namespace.rb
View file @
ca089f59
...
...
@@ -34,6 +34,8 @@ module Storage
# So we basically we mute exceptions in next actions
begin
send_update_instructions
write_projects_full_path_config
true
rescue
# Returning false does not rollback after_* transaction but gives
...
...
app/models/namespace.rb
View file @
ca089f59
...
...
@@ -268,4 +268,11 @@ class Namespace < ActiveRecord::Base
def
namespace_previously_created_with_same_path?
RedirectRoute
.
permanent
.
exists?
(
path:
path
)
end
def
write_projects_full_path_config
all_projects
.
each
do
|
project
|
project
.
expires_full_path_cache
# we need to clear cache to validate renames correctly
project
.
write_repository_config
(
:fullpath
,
project
.
full_path
)
end
end
end
spec/models/namespace_spec.rb
View file @
ca089f59
...
...
@@ -240,6 +240,20 @@ describe Namespace do
end
end
end
it
'updates project full path in .git/config for each project inside namespace'
do
parent
=
create
(
:group
,
name:
'mygroup'
,
path:
'mygroup'
)
subgroup
=
create
(
:group
,
name:
'mysubgroup'
,
path:
'mysubgroup'
,
parent:
parent
)
project_in_parent_group
=
create
(
:project
,
:repository
,
namespace:
parent
,
name:
'foo1'
)
hashed_project_in_subgroup
=
create
(
:project
,
:repository
,
:hashed
,
namespace:
subgroup
,
name:
'foo2'
)
legacy_project_in_subgroup
=
create
(
:project
,
:repository
,
namespace:
subgroup
,
name:
'foo3'
)
parent
.
update
(
path:
'mygroup_new'
)
expect
(
project_in_parent_group
.
repo
.
config
[
'gitlab.fullpath'
]).
to
eq
"mygroup_new/
#{
project_in_parent_group
.
path
}
"
expect
(
hashed_project_in_subgroup
.
repo
.
config
[
'gitlab.fullpath'
]).
to
eq
"mygroup_new/mysubgroup/
#{
hashed_project_in_subgroup
.
path
}
"
expect
(
legacy_project_in_subgroup
.
repo
.
config
[
'gitlab.fullpath'
]).
to
eq
"mygroup_new/mysubgroup/
#{
legacy_project_in_subgroup
.
path
}
"
end
end
describe
'#rm_dir'
,
'callback'
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