Commit 289a164b authored by Gabriel Mazetto's avatar Gabriel Mazetto

Rename path_with_namespace -> disk_path when dealing with the filesystem

parent 66d4f259
...@@ -8,10 +8,10 @@ module Projects ...@@ -8,10 +8,10 @@ module Projects
def execute(new_repository_storage_key) def execute(new_repository_storage_key)
new_storage_path = Gitlab.config.repositories.storages[new_repository_storage_key]['path'] 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? 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 end
if result if result
...@@ -31,20 +31,20 @@ module Projects ...@@ -31,20 +31,20 @@ module Projects
def mark_old_paths_for_archive def mark_old_paths_for_archive
old_repository_storage_path = project.repository_storage_path 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` # Notice that the block passed to `run_after_commit` will run with `project`
# as its context # as its context
project.run_after_commit do project.run_after_commit do
GitlabShellWorker.perform_async(:mv_repository, GitlabShellWorker.perform_async(:mv_repository,
old_repository_storage_path, old_repository_storage_path,
path_with_namespace, disk_path,
new_project_path) new_project_path)
if wiki.repository_exists? if wiki.repository_exists?
GitlabShellWorker.perform_async(:mv_repository, GitlabShellWorker.perform_async(:mv_repository,
old_repository_storage_path, old_repository_storage_path,
"#{path_with_namespace}.wiki", "#{disk_path}.wiki",
"#{new_project_path}.wiki") "#{new_project_path}.wiki")
end end
end end
......
...@@ -32,13 +32,13 @@ describe Projects::UpdateRepositoryStorageService do ...@@ -32,13 +32,13 @@ describe Projects::UpdateRepositoryStorageService do
context 'when the move succeeds' do context 'when the move succeeds' do
it 'moves the repository to the new storage and unmarks the repository as read only' do it 'moves the repository to the new storage and unmarks the repository as read only' do
expect(gitlab_shell).to receive(:mv_storage) 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) .and_return(true)
expect(GitlabShellWorker).to receive(:perform_async) expect(GitlabShellWorker).to receive(:perform_async)
.with(:mv_repository, .with(:mv_repository,
'tmp/tests/storage_a', 'tmp/tests/storage_a',
project.path_with_namespace, project.disk_path,
"#{project.path_with_namespace}+#{project.id}+moved+#{time.to_i}") "#{project.disk_path}+#{project.id}+moved+#{time.to_i}")
subject.execute('b') subject.execute('b')
...@@ -50,7 +50,7 @@ describe Projects::UpdateRepositoryStorageService do ...@@ -50,7 +50,7 @@ describe Projects::UpdateRepositoryStorageService do
context 'when the move fails' do context 'when the move fails' do
it 'unmarks the repository as read-only without updating the repository storage' do it 'unmarks the repository as read-only without updating the repository storage' do
expect(gitlab_shell).to receive(:mv_storage) 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) .and_return(false)
expect(GitlabShellWorker).not_to receive(:perform_async) expect(GitlabShellWorker).not_to receive(:perform_async)
...@@ -72,22 +72,22 @@ describe Projects::UpdateRepositoryStorageService do ...@@ -72,22 +72,22 @@ describe Projects::UpdateRepositoryStorageService do
context 'when the move succeeds' 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 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) 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) .and_return(true)
expect(GitlabShellWorker).to receive(:perform_async) expect(GitlabShellWorker).to receive(:perform_async)
.with(:mv_repository, .with(:mv_repository,
'tmp/tests/storage_a', 'tmp/tests/storage_a',
project.path_with_namespace, project.disk_path,
"#{project.path_with_namespace}+#{project.id}+moved+#{time.to_i}") "#{project.disk_path}+#{project.id}+moved+#{time.to_i}")
expect(gitlab_shell).to receive(:mv_storage) 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) .and_return(true)
expect(GitlabShellWorker).to receive(:perform_async) expect(GitlabShellWorker).to receive(:perform_async)
.with(:mv_repository, .with(:mv_repository,
'tmp/tests/storage_a', 'tmp/tests/storage_a',
"#{project.path_with_namespace}.wiki", "#{project.disk_path}.wiki",
"#{project.path_with_namespace}+#{project.id}+moved+#{time.to_i}.wiki") "#{project.disk_path}+#{project.id}+moved+#{time.to_i}.wiki")
subject.execute('b') subject.execute('b')
...@@ -99,10 +99,10 @@ describe Projects::UpdateRepositoryStorageService do ...@@ -99,10 +99,10 @@ describe Projects::UpdateRepositoryStorageService do
context 'when the move of the wiki fails' do context 'when the move of the wiki fails' do
it 'unmarks the repository as read-only without updating the repository storage' do it 'unmarks the repository as read-only without updating the repository storage' do
expect(gitlab_shell).to receive(:mv_storage) 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) .and_return(true)
expect(gitlab_shell).to receive(:mv_storage) 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) .and_return(false)
expect(GitlabShellWorker).not_to receive(:perform_async) expect(GitlabShellWorker).not_to receive(:perform_async)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment