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