Commit c6dee998 authored by Gabriel Mazetto's avatar Gabriel Mazetto

Rename path_with_namespace -> disk_path when dealing with the filesystem

parent abb87832
......@@ -1198,7 +1198,7 @@ class Project < ActiveRecord::Base
end
def pages_path
File.join(Settings.pages.path, path_with_namespace)
File.join(Settings.pages.path, disk_path)
end
def public_pages_path
......@@ -1256,7 +1256,7 @@ class Project < ActiveRecord::Base
end
def export_path
File.join(Gitlab::ImportExport.storage_path, path_with_namespace)
File.join(Gitlab::ImportExport.storage_path, disk_path)
end
def export_project_path
......
......@@ -40,7 +40,7 @@ module Projects
private
def repo_path
project.path_with_namespace
project.disk_path
end
def wiki_path
......
......@@ -2,7 +2,7 @@ module Projects
module ImportExport
class ExportService < BaseService
def execute(_options = {})
@shared = Gitlab::ImportExport::Shared.new(relative_path: File.join(project.path_with_namespace, 'work'))
@shared = Gitlab::ImportExport::Shared.new(relative_path: File.join(project.disk_path, 'work'))
save_all
end
......
......@@ -51,7 +51,7 @@ module Projects
end
def clone_repository
gitlab_shell.import_repository(project.repository_storage_path, project.path_with_namespace, project.import_url)
gitlab_shell.import_repository(project.repository_storage_path, project.disk_path, project.import_url)
end
def fetch_repository
......
......@@ -142,11 +142,11 @@ module Backup
end
def path_to_bundle(project)
File.join(backup_repos_path, project.path_with_namespace + '.bundle')
File.join(backup_repos_path, project.disk_path + '.bundle')
end
def path_to_tars(project, dir = nil)
path = File.join(backup_repos_path, project.path_with_namespace)
path = File.join(backup_repos_path, project.disk_path)
if dir
File.join(path, "#{dir}.tar")
......
......@@ -13,7 +13,7 @@ module Gitlab
def restore
return true unless File.exist?(@path_to_bundle)
gitlab_shell.import_repository(@project.repository_storage_path, @project.path_with_namespace, @path_to_bundle)
gitlab_shell.import_repository(@project.repository_storage_path, @project.disk_path, @path_to_bundle)
rescue => e
@shared.error(e)
false
......
......@@ -64,7 +64,7 @@ FactoryGirl.define do
# We delete hooks so that gitlab-shell will not try to authenticate with
# an API that isn't running
FileUtils.rm_r(File.join(project.repository_storage_path, "#{project.path_with_namespace}.git", 'hooks'))
FileUtils.rm_r(File.join(project.repository_storage_path, "#{project.disk_path}.git", 'hooks'))
end
end
......@@ -72,7 +72,7 @@ FactoryGirl.define do
after(:create) do |project|
raise "Failed to create repository!" unless project.create_repository
FileUtils.rm_r(File.join(project.repository_storage_path, "#{project.path_with_namespace}.git", 'refs'))
FileUtils.rm_r(File.join(project.repository_storage_path, "#{project.disk_path}.git", 'refs'))
end
end
......
......@@ -4,7 +4,7 @@ describe Gitlab::GitalyClient::NotificationService do
describe '#post_receive' do
let(:project) { create(:empty_project) }
let(:storage_name) { project.repository_storage }
let(:relative_path) { project.path_with_namespace + '.git' }
let(:relative_path) { project.disk_path + '.git' }
subject { described_class.new(project.repository) }
it 'sends a post_receive message' do
......
......@@ -3,7 +3,7 @@ require 'spec_helper'
describe Gitlab::GitalyClient::RefService do
let(:project) { create(:empty_project) }
let(:storage_name) { project.repository_storage }
let(:relative_path) { project.path_with_namespace + '.git' }
let(:relative_path) { project.disk_path + '.git' }
let(:client) { described_class.new(project.repository) }
describe '#branches' do
......
......@@ -135,7 +135,7 @@ describe JiraService do
body: hash_including(
GlobalID: "GitLab",
object: {
url: "#{Gitlab.config.gitlab.url}/#{project.path_with_namespace}/commit/#{merge_request.diff_head_sha}",
url: "#{Gitlab.config.gitlab.url}/#{project.full_path}/commit/#{merge_request.diff_head_sha}",
title: "GitLab: Solved by commit #{merge_request.diff_head_sha}.",
icon: { title: "GitLab", url16x16: "https://gitlab.com/favicon.ico" },
status: { resolved: true }
......@@ -159,7 +159,7 @@ describe JiraService do
@jira_service.close_issue(merge_request, ExternalIssue.new("JIRA-123", project))
expect(WebMock).to have_requested(:post, @comment_url).with(
body: /#{custom_base_url}\/#{project.path_with_namespace}\/commit\/#{merge_request.diff_head_sha}/
body: /#{custom_base_url}\/#{project.full_path}\/commit\/#{merge_request.diff_head_sha}/
).once
end
......@@ -174,7 +174,7 @@ describe JiraService do
@jira_service.close_issue(merge_request, ExternalIssue.new("JIRA-123", project))
expect(WebMock).to have_requested(:post, @comment_url).with(
body: /#{Gitlab.config.gitlab.url}\/#{project.path_with_namespace}\/commit\/#{merge_request.diff_head_sha}/
body: /#{Gitlab.config.gitlab.url}\/#{project.full_path}\/commit\/#{merge_request.diff_head_sha}/
).once
end
......
......@@ -1369,7 +1369,7 @@ describe Project do
context 'using a regular repository' do
it 'creates the repository' do
expect(shell).to receive(:add_repository)
.with(project.repository_storage_path, project.path_with_namespace)
.with(project.repository_storage_path, project.disk_path)
.and_return(true)
expect(project.repository).to receive(:after_create)
......@@ -1379,7 +1379,7 @@ describe Project do
it 'adds an error if the repository could not be created' do
expect(shell).to receive(:add_repository)
.with(project.repository_storage_path, project.path_with_namespace)
.with(project.repository_storage_path, project.disk_path)
.and_return(false)
expect(project.repository).not_to receive(:after_create)
......@@ -1412,7 +1412,7 @@ describe Project do
.and_return(false)
allow(shell).to receive(:add_repository)
.with(project.repository_storage_path, project.path_with_namespace)
.with(project.repository_storage_path, project.disk_path)
.and_return(true)
expect(project).to receive(:create_repository).with(force: true)
......@@ -1436,7 +1436,7 @@ describe Project do
.and_return(false)
expect(shell).to receive(:add_repository)
.with(project.repository_storage_path, project.path_with_namespace)
.with(project.repository_storage_path, project.disk_path)
.and_return(true)
project.ensure_repository
......@@ -1600,7 +1600,7 @@ describe Project do
before do
allow_any_instance_of(Gitlab::Shell).to receive(:import_repository)
.with(project.repository_storage_path, project.path_with_namespace, project.import_url)
.with(project.repository_storage_path, project.disk_path, project.import_url)
.and_return(true)
expect_any_instance_of(Repository).to receive(:after_import)
......@@ -1738,7 +1738,7 @@ describe Project do
it 'schedules a RepositoryForkWorker job' do
expect(RepositoryForkWorker).to receive(:perform_async)
.with(project.id, forked_from_project.repository_storage_path,
forked_from_project.path_with_namespace, project.namespace.full_path)
forked_from_project.disk_path, project.namespace.full_path)
project.add_import_job
end
......
......@@ -962,7 +962,7 @@ describe Repository do
end
it 'returns false if no full path can be constructed' do
allow(repository).to receive(:path_with_namespace).and_return(nil)
allow(repository).to receive(:full_path).and_return(nil)
expect(repository.exists?).to eq(false)
end
......
......@@ -59,7 +59,7 @@ describe Projects::TransferService do
end
def project_path(project)
File.join(project.repository_storage_path, "#{project.path_with_namespace}.git")
File.join(project.repository_storage_path, "#{project.disk_path}.git")
end
def current_path
......
......@@ -117,7 +117,7 @@ describe 'gitlab:app namespace rake task' do
describe 'backup creation and deletion using custom_hooks' do
let(:project) { create(:project, :repository) }
let(:user_backup_path) { "repositories/#{project.path_with_namespace}" }
let(:user_backup_path) { "repositories/#{project.disk_path}" }
before(:each) do
@origin_cd = Dir.pwd
......@@ -261,8 +261,8 @@ describe 'gitlab:app namespace rake task' do
%W{tar -tvf #{@backup_tar} repositories}
)
expect(exit_status).to eq(0)
expect(tar_contents).to match("repositories/#{project_a.path_with_namespace}.bundle")
expect(tar_contents).to match("repositories/#{project_b.path_with_namespace}.bundle")
expect(tar_contents).to match("repositories/#{project_a.disk_path}.bundle")
expect(tar_contents).to match("repositories/#{project_b.disk_path}.bundle")
end
end
end # backup_create task
......
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