summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2017-12-10 23:36:46 -0800
committerStan Hu <stanhu@gmail.com>2017-12-10 23:36:46 -0800
commit917a112ef08dbe217818e3ec00cb03218f77d030 (patch)
treeda4ddd59897957d6e796bddfe9790fb27d09abbb
parente8cced80777d75eab98a1ce81742d860e60a6e15 (diff)
downloadgitlab-ce-917a112ef08dbe217818e3ec00cb03218f77d030.tar.gz
Simplify normalizing of paths
-rw-r--r--lib/gitlab/bare_repository_import/repository.rb7
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/gitlab/bare_repository_import/repository.rb b/lib/gitlab/bare_repository_import/repository.rb
index d3971db1c89..fa7891c8dcc 100644
--- a/lib/gitlab/bare_repository_import/repository.rb
+++ b/lib/gitlab/bare_repository_import/repository.rb
@@ -7,6 +7,8 @@ module Gitlab
@root_path = root_path
@repo_path = repo_path
+ @root_path << '/' unless root_path.ends_with?('/')
+
# Split path into 'all/the/namespaces' and 'project_name'
@group_path, _, @project_name = repo_relative_path.rpartition('/')
end
@@ -34,11 +36,8 @@ module Gitlab
private
def repo_relative_path
- absolute_path = Pathname.new(repo_path)
- project_root = Pathname.new(@root_path)
-
# Remove root path and `.git` at the end
- absolute_path.relative_path_from(project_root).to_s.gsub(/\.git$/, '')
+ repo_path[@root_path.size...-4]
end
end
end