diff options
author | Douwe Maan <douwe@gitlab.com> | 2018-04-13 11:16:39 +0300 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2018-04-13 11:16:39 +0300 |
commit | ac149be040009eff8847a1078031d92c5afc27d8 (patch) | |
tree | 572394bee55c1da858010cedb7cdcda319fbb1bb /lib/gitlab/git | |
parent | a45729c8a7b959d03b021bdc5a15ed0219e9a6ab (diff) | |
parent | a752c56ca82d6f0fdee340f5d494347a4aa90072 (diff) |
Merge branch 'zj-storage-path-deprecation' into 'master'
Deprecate legacy disk paths
See merge request gitlab-org/gitlab-ce!18332
Diffstat (limited to 'lib/gitlab/git')
-rw-r--r-- | lib/gitlab/git/repository.rb | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/lib/gitlab/git/repository.rb b/lib/gitlab/git/repository.rb index 36992cbcca0..986b3228b3e 100644 --- a/lib/gitlab/git/repository.rb +++ b/lib/gitlab/git/repository.rb @@ -75,9 +75,6 @@ module Gitlab end end - # Full path to repo - attr_reader :path - # Directory name of repo attr_reader :name @@ -96,14 +93,13 @@ module Gitlab @relative_path = relative_path @gl_repository = gl_repository - storage_path = Gitlab.config.repositories.storages[@storage].legacy_disk_path @gitlab_projects = Gitlab::Git::GitlabProjects.new( storage, relative_path, global_hooks_path: Gitlab.config.gitlab_shell.hooks_path, logger: Rails.logger ) - @path = File.join(storage_path, @relative_path) + @name = @relative_path.split("/").last end @@ -111,6 +107,12 @@ module Gitlab path == other.path end + def path + @path ||= File.join( + Gitlab.config.repositories.storages[@storage].legacy_disk_path, @relative_path + ) + end + # Default branch in the repository def root_ref @root_ref ||= gitaly_migrate(:root_ref) do |is_enabled| @@ -139,12 +141,12 @@ module Gitlab end def exists? - Gitlab::GitalyClient.migrate(:repository_exists, status: Gitlab::GitalyClient::MigrationStatus::OPT_OUT) do |enabled| + Gitlab::GitalyClient.migrate(:repository_exists, status: Gitlab::GitalyClient::MigrationStatus::OPT_OUT) do |enabled| if enabled gitaly_repository_client.exists? else circuit_breaker.perform do - File.exist?(File.join(@path, 'refs')) + File.exist?(File.join(path, 'refs')) end end end @@ -1018,7 +1020,7 @@ module Gitlab if is_enabled gitaly_repository_client.info_attributes else - attributes_path = File.join(File.expand_path(@path), 'info', 'attributes') + attributes_path = File.join(File.expand_path(path), 'info', 'attributes') if File.exist?(attributes_path) File.read(attributes_path) |