diff options
| author | Douwe Maan <douwe@gitlab.com> | 2018-05-11 13:55:43 +0000 |
|---|---|---|
| committer | Douwe Maan <douwe@gitlab.com> | 2018-05-11 13:55:43 +0000 |
| commit | 27d0c4298649b4ecfcf593132492cf671365a424 (patch) | |
| tree | 492a73c61b8d12be7bfb8bdcb1e8dc5b4a7f81db /lib | |
| parent | 8c2b73dc8c5adf41b94033fe1d0a265524e304c4 (diff) | |
| parent | cc7931cc9c38a54eb7d5b721113f8bf89781e447 (diff) | |
| download | gitlab-ce-27d0c4298649b4ecfcf593132492cf671365a424.tar.gz | |
Merge branch 'zj-remove-repo-path-strip-storage-path' into 'master'
Remove Gitlab::RepoPath.strip_storage_path
See merge request gitlab-org/gitlab-ce!18904
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/gitlab/repo_path.rb | 19 |
1 files changed, 2 insertions, 17 deletions
diff --git a/lib/gitlab/repo_path.rb b/lib/gitlab/repo_path.rb index 1fa2a19b0af..4888184403c 100644 --- a/lib/gitlab/repo_path.rb +++ b/lib/gitlab/repo_path.rb @@ -4,7 +4,8 @@ module Gitlab def self.parse(repo_path) wiki = false - project_path = strip_storage_path(repo_path.sub(/\.git\z/, ''), fail_on_not_found: false) + project_path = repo_path.sub(/\.git\z/, '').sub(%r{\A/}, '') + project, was_redirected = find_project(project_path) if project_path.end_with?('.wiki') && project.nil? @@ -17,22 +18,6 @@ module Gitlab [project, wiki, redirected_path] end - def self.strip_storage_path(repo_path, fail_on_not_found: true) - result = repo_path - - storage = Gitlab.config.repositories.storages.values.find do |params| - repo_path.start_with?(params.legacy_disk_path) - end - - if storage - result = result.sub(storage.legacy_disk_path, '') - elsif fail_on_not_found - raise NotFoundError.new("No known storage path matches #{repo_path.inspect}") - end - - result.sub(%r{\A/*}, '') - end - def self.find_project(project_path) project = Project.find_by_full_path(project_path, follow_redirects: true) was_redirected = project && project.full_path.casecmp(project_path) != 0 |
