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
289a164b
Commit
289a164b
authored
Jul 21, 2017
by
Gabriel Mazetto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename path_with_namespace -> disk_path when dealing with the filesystem
parent
66d4f259
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
17 deletions
+17
-17
app/services/projects/update_repository_storage_service.rb
app/services/projects/update_repository_storage_service.rb
+5
-5
spec/services/projects/update_repository_storage_service_spec.rb
...rvices/projects/update_repository_storage_service_spec.rb
+12
-12
No files found.
app/services/projects/update_repository_storage_service.rb
View file @
289a164b
...
...
@@ -8,10 +8,10 @@ module Projects
def
execute
(
new_repository_storage_key
)
new_storage_path
=
Gitlab
.
config
.
repositories
.
storages
[
new_repository_storage_key
][
'path'
]
result
=
move_storage
(
project
.
path_with_namespace
,
new_storage_path
)
result
=
move_storage
(
project
.
disk_path
,
new_storage_path
)
if
project
.
wiki
.
repository_exists?
result
&&=
move_storage
(
"
#{
project
.
path_with_namespace
}
.wiki"
,
new_storage_path
)
result
&&=
move_storage
(
"
#{
project
.
disk_path
}
.wiki"
,
new_storage_path
)
end
if
result
...
...
@@ -31,20 +31,20 @@ module Projects
def
mark_old_paths_for_archive
old_repository_storage_path
=
project
.
repository_storage_path
new_project_path
=
moved_path
(
project
.
path_with_namespace
)
new_project_path
=
moved_path
(
project
.
disk_path
)
# Notice that the block passed to `run_after_commit` will run with `project`
# as its context
project
.
run_after_commit
do
GitlabShellWorker
.
perform_async
(
:mv_repository
,
old_repository_storage_path
,
path_with_namespace
,
disk_path
,
new_project_path
)
if
wiki
.
repository_exists?
GitlabShellWorker
.
perform_async
(
:mv_repository
,
old_repository_storage_path
,
"
#{
path_with_namespace
}
.wiki"
,
"
#{
disk_path
}
.wiki"
,
"
#{
new_project_path
}
.wiki"
)
end
end
...
...
spec/services/projects/update_repository_storage_service_spec.rb
View file @
289a164b
...
...
@@ -32,13 +32,13 @@ describe Projects::UpdateRepositoryStorageService do
context
'when the move succeeds'
do
it
'moves the repository to the new storage and unmarks the repository as read only'
do
expect
(
gitlab_shell
).
to
receive
(
:mv_storage
)
.
with
(
'tmp/tests/storage_a'
,
project
.
path_with_namespace
,
'tmp/tests/storage_b'
)
.
with
(
'tmp/tests/storage_a'
,
project
.
disk_path
,
'tmp/tests/storage_b'
)
.
and_return
(
true
)
expect
(
GitlabShellWorker
).
to
receive
(
:perform_async
)
.
with
(
:mv_repository
,
'tmp/tests/storage_a'
,
project
.
path_with_namespace
,
"
#{
project
.
path_with_namespace
}
+
#{
project
.
id
}
+moved+
#{
time
.
to_i
}
"
)
project
.
disk_path
,
"
#{
project
.
disk_path
}
+
#{
project
.
id
}
+moved+
#{
time
.
to_i
}
"
)
subject
.
execute
(
'b'
)
...
...
@@ -50,7 +50,7 @@ describe Projects::UpdateRepositoryStorageService do
context
'when the move fails'
do
it
'unmarks the repository as read-only without updating the repository storage'
do
expect
(
gitlab_shell
).
to
receive
(
:mv_storage
)
.
with
(
'tmp/tests/storage_a'
,
project
.
path_with_namespace
,
'tmp/tests/storage_b'
)
.
with
(
'tmp/tests/storage_a'
,
project
.
disk_path
,
'tmp/tests/storage_b'
)
.
and_return
(
false
)
expect
(
GitlabShellWorker
).
not_to
receive
(
:perform_async
)
...
...
@@ -72,22 +72,22 @@ describe Projects::UpdateRepositoryStorageService do
context
'when the move succeeds'
do
it
'moves the repository and its wiki to the new storage and unmarks the repository as read only'
do
expect
(
gitlab_shell
).
to
receive
(
:mv_storage
)
.
with
(
'tmp/tests/storage_a'
,
project
.
path_with_namespace
,
'tmp/tests/storage_b'
)
.
with
(
'tmp/tests/storage_a'
,
project
.
disk_path
,
'tmp/tests/storage_b'
)
.
and_return
(
true
)
expect
(
GitlabShellWorker
).
to
receive
(
:perform_async
)
.
with
(
:mv_repository
,
'tmp/tests/storage_a'
,
project
.
path_with_namespace
,
"
#{
project
.
path_with_namespace
}
+
#{
project
.
id
}
+moved+
#{
time
.
to_i
}
"
)
project
.
disk_path
,
"
#{
project
.
disk_path
}
+
#{
project
.
id
}
+moved+
#{
time
.
to_i
}
"
)
expect
(
gitlab_shell
).
to
receive
(
:mv_storage
)
.
with
(
'tmp/tests/storage_a'
,
"
#{
project
.
path_with_namespace
}
.wiki"
,
'tmp/tests/storage_b'
)
.
with
(
'tmp/tests/storage_a'
,
"
#{
project
.
disk_path
}
.wiki"
,
'tmp/tests/storage_b'
)
.
and_return
(
true
)
expect
(
GitlabShellWorker
).
to
receive
(
:perform_async
)
.
with
(
:mv_repository
,
'tmp/tests/storage_a'
,
"
#{
project
.
path_with_namespace
}
.wiki"
,
"
#{
project
.
path_with_namespace
}
+
#{
project
.
id
}
+moved+
#{
time
.
to_i
}
.wiki"
)
"
#{
project
.
disk_path
}
.wiki"
,
"
#{
project
.
disk_path
}
+
#{
project
.
id
}
+moved+
#{
time
.
to_i
}
.wiki"
)
subject
.
execute
(
'b'
)
...
...
@@ -99,10 +99,10 @@ describe Projects::UpdateRepositoryStorageService do
context
'when the move of the wiki fails'
do
it
'unmarks the repository as read-only without updating the repository storage'
do
expect
(
gitlab_shell
).
to
receive
(
:mv_storage
)
.
with
(
'tmp/tests/storage_a'
,
project
.
path_with_namespace
,
'tmp/tests/storage_b'
)
.
with
(
'tmp/tests/storage_a'
,
project
.
disk_path
,
'tmp/tests/storage_b'
)
.
and_return
(
true
)
expect
(
gitlab_shell
).
to
receive
(
:mv_storage
)
.
with
(
'tmp/tests/storage_a'
,
"
#{
project
.
path_with_namespace
}
.wiki"
,
'tmp/tests/storage_b'
)
.
with
(
'tmp/tests/storage_a'
,
"
#{
project
.
disk_path
}
.wiki"
,
'tmp/tests/storage_b'
)
.
and_return
(
false
)
expect
(
GitlabShellWorker
).
not_to
receive
(
:perform_async
)
...
...
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