summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGabriel Mazetto <brodock@gmail.com>2017-07-23 09:05:34 +0200
committerGabriel Mazetto <brodock@gmail.com>2017-08-01 07:28:13 +0200
commit16107364b8f0904e25a70dac29a26c435118fb29 (patch)
tree7ac9d4869906932d0b39121d0bd2c20a87d9e473
parentfb06a4d8fe7bb10c2784f323261cfde04718aec9 (diff)
downloadgitlab-ce-16107364b8f0904e25a70dac29a26c435118fb29.tar.gz
Make disk_path keyword argument and optional
-rw-r--r--app/models/project.rb7
-rw-r--r--app/models/project_wiki.rb2
-rw-r--r--app/models/repository.rb4
-rw-r--r--app/services/projects/destroy_service.rb2
4 files changed, 7 insertions, 8 deletions
diff --git a/app/models/project.rb b/app/models/project.rb
index fe85e3e289a..dd025f5574d 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -480,7 +480,7 @@ class Project < ActiveRecord::Base
end
def repository
- @repository ||= Repository.new(full_path, disk_path, self)
+ @repository ||= Repository.new(full_path, self, disk_path: disk_path)
end
def container_registry_url
@@ -980,9 +980,8 @@ class Project < ActiveRecord::Base
# Expires various caches before a project is renamed.
def expire_caches_before_rename(old_path)
- # TODO: if we start using UUIDs for cache, we don't need to do this HACK anymore
- repo = Repository.new(old_path, old_path, self)
- wiki = Repository.new("#{old_path}.wiki", "#{old_path}.wiki", self)
+ repo = Repository.new(old_path, self)
+ wiki = Repository.new("#{old_path}.wiki", self)
if repo.exists?
repo.before_delete
diff --git a/app/models/project_wiki.rb b/app/models/project_wiki.rb
index 2dd49adc880..e8929a35836 100644
--- a/app/models/project_wiki.rb
+++ b/app/models/project_wiki.rb
@@ -138,7 +138,7 @@ class ProjectWiki
end
def repository
- @repository ||= Repository.new(full_path, disk_path, @project)
+ @repository ||= Repository.new(full_path, @project, disk_path: disk_path)
end
def default_branch
diff --git a/app/models/repository.rb b/app/models/repository.rb
index 5d39e2e271d..7ea9f1459a0 100644
--- a/app/models/repository.rb
+++ b/app/models/repository.rb
@@ -52,9 +52,9 @@ class Repository
end
end
- def initialize(full_path, disk_path, project)
+ def initialize(full_path, project, disk_path: nil)
@full_path = full_path
- @disk_path = disk_path
+ @disk_path = disk_path || full_path
@project = project
end
diff --git a/app/services/projects/destroy_service.rb b/app/services/projects/destroy_service.rb
index b7f4dba08a9..11ad4838471 100644
--- a/app/services/projects/destroy_service.rb
+++ b/app/services/projects/destroy_service.rb
@@ -127,7 +127,7 @@ module Projects
def flush_caches(project)
project.repository.before_delete
- Repository.new(wiki_path, repo_path, project).before_delete
+ Repository.new(wiki_path, project, disk_path: repo_path).before_delete
end
end
end