summaryrefslogtreecommitdiff
path: root/lib/gitlab/bare_repository_import/repository.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/gitlab/bare_repository_import/repository.rb')
-rw-r--r--lib/gitlab/bare_repository_import/repository.rb5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/gitlab/bare_repository_import/repository.rb b/lib/gitlab/bare_repository_import/repository.rb
index 8574ac6eb30..d3971db1c89 100644
--- a/lib/gitlab/bare_repository_import/repository.rb
+++ b/lib/gitlab/bare_repository_import/repository.rb
@@ -34,8 +34,11 @@ 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
- repo_path[@root_path.size...-4]
+ absolute_path.relative_path_from(project_root).to_s.gsub(/\.git$/, '')
end
end
end