summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJames Lopez <james@gitlab.com>2017-12-11 08:47:50 +0000
committerLUKE BENNETT <lbennett@gitlab.com>2017-12-13 13:40:04 +0000
commit0f04fa2859d436e78de2f6d30e01b2134a094103 (patch)
treeffc5fac83e27940bc1783d656c7b491ddd7d0ef4 /lib
parent0d09108ad2bb2605d0ec2b50ac7d3f46db3ee728 (diff)
downloadgitlab-ce-0f04fa2859d436e78de2f6d30e01b2134a094103.tar.gz
Merge branch 'sh-fix-import-rake-task' into 'master'
Fix gitlab:import:repos Rake task moving repositories into the wrong location Closes #40765 See merge request gitlab-org/gitlab-ce!15823 (cherry picked from commit 7694ae887885c66eb633d3f78eac3128a08dc978) 78f7c3c8 Fix gitlab:import:repos Rake task moving repositories into the wrong location e8cced80 Fix failing importer test case on MySQL due to missing trailing slash in root path 917a112e Simplify normalizing of paths 86661a3a Use build instead of create in importer spec f1eaab7b Remove the need for destroy and add a comment in the spec
Diffstat (limited to 'lib')
-rw-r--r--lib/gitlab/bare_repository_import/importer.rb1
-rw-r--r--lib/gitlab/bare_repository_import/repository.rb2
2 files changed, 3 insertions, 0 deletions
diff --git a/lib/gitlab/bare_repository_import/importer.rb b/lib/gitlab/bare_repository_import/importer.rb
index 196de667805..298409d8b5a 100644
--- a/lib/gitlab/bare_repository_import/importer.rb
+++ b/lib/gitlab/bare_repository_import/importer.rb
@@ -55,6 +55,7 @@ module Gitlab
name: project_name,
path: project_name,
skip_disk_validation: true,
+ import_type: 'gitlab_project',
namespace_id: group&.id).execute
if project.persisted? && mv_repo(project)
diff --git a/lib/gitlab/bare_repository_import/repository.rb b/lib/gitlab/bare_repository_import/repository.rb
index 8574ac6eb30..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