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
Boxiang Sun
gitlab-ce
Commits
3b91e563
Commit
3b91e563
authored
Mar 13, 2018
by
Michael Kozono
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Appease Metrics/AbcSize cop
parent
ef62a7c2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
18 deletions
+22
-18
app/models/concerns/storage/legacy_namespace.rb
app/models/concerns/storage/legacy_namespace.rb
+22
-18
No files found.
app/models/concerns/storage/legacy_namespace.rb
View file @
3b91e563
...
...
@@ -13,26 +13,10 @@ module Storage
expires_full_path_cache
# Move the namespace directory in all storage paths used by member projects
repository_storage_paths
.
each
do
|
repository_storage_path
|
# Ensure old directory exists before moving it
gitlab_shell
.
add_namespace
(
repository_storage_path
,
full_path_was
)
# Ensure new directory exists before moving it (if there's a parent)
gitlab_shell
.
add_namespace
(
repository_storage_path
,
parent
.
full_path
)
if
parent
unless
gitlab_shell
.
mv_namespace
(
repository_storage_path
,
full_path_was
,
full_path
)
Rails
.
logger
.
error
"Exception moving path
#{
repository_storage_path
}
from
#{
full_path_was
}
to
#{
full_path
}
"
# if we cannot move namespace directory we should rollback
# db changes in order to prevent out of sync between db and fs
raise
Gitlab
::
UpdatePathError
.
new
(
'namespace directory cannot be moved'
)
end
end
move_repositories
if
parent_changed?
former_parent_full_path
=
parent_was
.
full_path
former_parent_full_path
=
parent_was
&
.
full_path
parent_full_path
=
parent
&
.
full_path
Gitlab
::
UploadsTransfer
.
new
.
move_namespace
(
path
,
former_parent_full_path
,
parent_full_path
)
Gitlab
::
PagesTransfer
.
new
.
move_namespace
(
path
,
former_parent_full_path
,
parent_full_path
)
...
...
@@ -68,6 +52,26 @@ module Storage
private
def
move_repositories
# Move the namespace directory in all storage paths used by member projects
repository_storage_paths
.
each
do
|
repository_storage_path
|
# Ensure old directory exists before moving it
gitlab_shell
.
add_namespace
(
repository_storage_path
,
full_path_was
)
# Ensure new directory exists before moving it (if there's a parent)
gitlab_shell
.
add_namespace
(
repository_storage_path
,
parent
.
full_path
)
if
parent
unless
gitlab_shell
.
mv_namespace
(
repository_storage_path
,
full_path_was
,
full_path
)
Rails
.
logger
.
error
"Exception moving path
#{
repository_storage_path
}
from
#{
full_path_was
}
to
#{
full_path
}
"
# if we cannot move namespace directory we should rollback
# db changes in order to prevent out of sync between db and fs
raise
Gitlab
::
UpdatePathError
.
new
(
'namespace directory cannot be moved'
)
end
end
end
def
old_repository_storage_paths
@old_repository_storage_paths
||=
repository_storage_paths
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