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
40242003
Commit
40242003
authored
May 12, 2017
by
Douwe Maan
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'bvl-fix-dynamic-path-query' into 'master'
Only rename namespaces and projects with an invalid path See merge request !11338
parents
9b0309db
48ffec9e
Hide 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 @
40242003
...
@@ -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
.
flat_map
{
|
path
|
[
"%/
#{
path
}
"
,
path
]
}
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 @
40242003
...
@@ -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