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
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
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
1 deletion
+32
-1
rename_base.rb
...atabase/rename_reserved_paths_migration/v1/rename_base.rb
+1
-1
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
end
def
path_patterns
@path_patterns
||=
paths
.
map
{
|
path
|
"%
#{
path
}
"
}
@path_patterns
||=
paths
.
map
{
|
path
|
[
"%/
#{
path
}
"
,
"
#{
path
}
"
]
}.
flatten
end
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
found_ids
=
subject
.
namespaces_for_paths
(
type: :child
).
map
(
&
:id
)
expect
(
found_ids
).
to
contain_exactly
(
child
.
id
)
end
end
...
...
@@ -39,6 +40,22 @@ describe Gitlab::Database::RenameReservedPathsMigration::V1::RenameNamespaces do
found_ids
=
subject
.
namespaces_for_paths
(
type: :child
).
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
)
end
end
...
...
@@ -53,6 +70,20 @@ describe Gitlab::Database::RenameReservedPathsMigration::V1::RenameNamespaces do
found_ids
=
subject
.
namespaces_for_paths
(
type: :top_level
).
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
)
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