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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
229ac39a
Commit
229ac39a
authored
Jun 12, 2017
by
Bob Van Landuyt
Committed by
Bob Van Landuyt
Jun 26, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Don't break rolling back when a namespace or project was renamed
parent
1ebb2255
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
21 additions
and
5 deletions
+21
-5
lib/gitlab/database/rename_reserved_paths_migration/v1/rename_namespaces.rb
...e/rename_reserved_paths_migration/v1/rename_namespaces.rb
+3
-3
lib/gitlab/database/rename_reserved_paths_migration/v1/rename_projects.rb
...ase/rename_reserved_paths_migration/v1/rename_projects.rb
+4
-2
spec/lib/gitlab/database/rename_reserved_paths_migration/v1/rename_namespaces_spec.rb
...ame_reserved_paths_migration/v1/rename_namespaces_spec.rb
+7
-0
spec/lib/gitlab/database/rename_reserved_paths_migration/v1/rename_projects_spec.rb
...ename_reserved_paths_migration/v1/rename_projects_spec.rb
+7
-0
No files found.
lib/gitlab/database/rename_reserved_paths_migration/v1/rename_namespaces.rb
View file @
229ac39a
...
...
@@ -43,15 +43,15 @@ module Gitlab
reverts_for_type
(
'namespace'
)
do
|
path_before_rename
,
current_path
|
matches_path
=
MigrationClasses
::
Route
.
arel_table
[
:path
].
matches
(
current_path
)
namespace
=
MigrationClasses
::
Namespace
.
joins
(
:route
)
.
where
(
matches_path
).
first
.
becomes
(
MigrationClasses
::
Namespace
)
.
where
(
matches_path
).
first
&
.
becomes
(
MigrationClasses
::
Namespace
)
if
namespace
perform_rename
(
namespace
,
current_path
,
path_before_rename
)
rename_namespace_dependencies
(
namespace
,
current_path
,
path_before_rename
)
else
say
"Couldn't rename namespace
#
#{
namespace
.
id
}
from
#{
current_path
}
"
\
"
back to
#{
path_before_rename
}
, namespace no longer exists
"
say
"Couldn't rename namespace
from
#{
current_path
}
back to
#{
path_before_rename
}
"
\
"
namespace was renamed, or no longer exists at the expected path
"
end
end
end
...
...
lib/gitlab/database/rename_reserved_paths_migration/v1/rename_projects.rb
View file @
229ac39a
...
...
@@ -38,8 +38,10 @@ module Gitlab
move_project_folders
(
project
,
current_path
,
path_before_rename
)
else
say
"Couldn't rename project#
#{
project
.
id
}
from
#{
current_path
}
"
\
"back to
#{
path_before_rename
}
, project no longer exists"
say
"Couldn't rename Project from
#{
current_path
}
back to "
\
"
#{
path_before_rename
}
, project was renamed or no longer "
\
"exists at the expected path."
end
end
end
...
...
spec/lib/gitlab/database/rename_reserved_paths_migration/v1/rename_namespaces_spec.rb
View file @
229ac39a
...
...
@@ -278,5 +278,12 @@ describe Gitlab::Database::RenameReservedPathsMigration::V1::RenameNamespaces, :
expect
(
File
.
directory?
(
expected_path
)).
to
be_truthy
end
it
"doesn't break when the namespace was renamed"
do
subject
.
rename_namespace
(
namespace
)
namespace
.
update_attributes!
(
path:
'renamed-afterwards'
)
expect
{
subject
.
revert_renames
}.
not_to
raise_error
end
end
end
spec/lib/gitlab/database/rename_reserved_paths_migration/v1/rename_projects_spec.rb
View file @
229ac39a
...
...
@@ -149,5 +149,12 @@ describe Gitlab::Database::RenameReservedPathsMigration::V1::RenameProjects, :tr
expect
(
File
.
directory?
(
expected_path
)).
to
be_truthy
end
it
"doesn't break when the project was renamed"
do
subject
.
rename_project
(
project
)
project
.
update_attributes!
(
path:
'renamed-afterwards'
)
expect
{
subject
.
revert_renames
}.
not_to
raise_error
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