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
3760a7c2
Commit
3760a7c2
authored
May 12, 2017
by
Bob Van Landuyt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Only rename namespaces and projects with an invalid path
For exact matches, not namespaces that end with an invalid path
parent
61f811e6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
1 deletion
+32
-1
lib/gitlab/database/rename_reserved_paths_migration/v1/rename_base.rb
...atabase/rename_reserved_paths_migration/v1/rename_base.rb
+1
-1
spec/lib/gitlab/database/rename_reserved_paths_migration/v1/rename_namespaces_spec.rb
...ame_reserved_paths_migration/v1/rename_namespaces_spec.rb
+31
-0
No files found.
lib/gitlab/database/rename_reserved_paths_migration/v1/rename_base.rb
View file @
3760a7c2
...
@@ -15,7 +15,7 @@ module Gitlab
...
@@ -15,7 +15,7 @@ module Gitlab
end
end
def
path_patterns
def
path_patterns
@path_patterns
||=
paths
.
map
{
|
path
|
"%
#{
path
}
"
}
@path_patterns
||=
paths
.
map
{
|
path
|
[
"%/
#{
path
}
"
,
"
#{
path
}
"
]
}.
flatten
end
end
def
rename_path_for_routable
(
routable
)
def
rename_path_for_routable
(
routable
)
...
...
spec/lib/gitlab/database/rename_reserved_paths_migration/v1/rename_namespaces_spec.rb
View file @
3760a7c2
...
@@ -23,6 +23,7 @@ describe Gitlab::Database::RenameReservedPathsMigration::V1::RenameNamespaces do
...
@@ -23,6 +23,7 @@ describe Gitlab::Database::RenameReservedPathsMigration::V1::RenameNamespaces do
found_ids
=
subject
.
namespaces_for_paths
(
type: :child
).
found_ids
=
subject
.
namespaces_for_paths
(
type: :child
).
map
(
&
:id
)
map
(
&
:id
)
expect
(
found_ids
).
to
contain_exactly
(
child
.
id
)
expect
(
found_ids
).
to
contain_exactly
(
child
.
id
)
end
end
end
end
...
@@ -39,6 +40,22 @@ describe Gitlab::Database::RenameReservedPathsMigration::V1::RenameNamespaces do
...
@@ -39,6 +40,22 @@ describe Gitlab::Database::RenameReservedPathsMigration::V1::RenameNamespaces do
found_ids
=
subject
.
namespaces_for_paths
(
type: :child
).
found_ids
=
subject
.
namespaces_for_paths
(
type: :child
).
map
(
&
:id
)
map
(
&
:id
)
expect
(
found_ids
).
to
contain_exactly
(
namespace
.
id
)
end
it
'has no namespaces that look the same'
do
_root_namespace
=
create
(
:namespace
,
path:
'THE-path'
)
_similar_path
=
create
(
:namespace
,
path:
'not-really-the-path'
,
parent:
create
(
:namespace
))
namespace
=
create
(
:namespace
,
path:
'the-path'
,
parent:
create
(
:namespace
))
found_ids
=
subject
.
namespaces_for_paths
(
type: :child
).
map
(
&
:id
)
expect
(
found_ids
).
to
contain_exactly
(
namespace
.
id
)
expect
(
found_ids
).
to
contain_exactly
(
namespace
.
id
)
end
end
end
end
...
@@ -53,6 +70,20 @@ describe Gitlab::Database::RenameReservedPathsMigration::V1::RenameNamespaces do
...
@@ -53,6 +70,20 @@ describe Gitlab::Database::RenameReservedPathsMigration::V1::RenameNamespaces do
found_ids
=
subject
.
namespaces_for_paths
(
type: :top_level
).
found_ids
=
subject
.
namespaces_for_paths
(
type: :top_level
).
map
(
&
:id
)
map
(
&
:id
)
expect
(
found_ids
).
to
contain_exactly
(
root_namespace
.
id
)
end
it
'has no namespaces that just look the same'
do
root_namespace
=
create
(
:namespace
,
path:
'the-path'
)
_similar_path
=
create
(
:namespace
,
path:
'not-really-the-path'
)
_child_namespace
=
create
(
:namespace
,
path:
'the-path'
,
parent:
create
(
:namespace
))
found_ids
=
subject
.
namespaces_for_paths
(
type: :top_level
).
map
(
&
:id
)
expect
(
found_ids
).
to
contain_exactly
(
root_namespace
.
id
)
expect
(
found_ids
).
to
contain_exactly
(
root_namespace
.
id
)
end
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