Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2017-12-09 01:48:52 +0300
committerStan Hu <stanhu@gmail.com>2017-12-09 01:56:43 +0300
commit78f7c3c8a2ac9f72b54e8e76005ef8810d1a068a (patch)
tree7a732ba640c04f19622798c2f087b86b0f779e2d /spec/lib/gitlab/bare_repository_import
parent806a68a81f1baeed07c146b1b5d9eb77796c46ba (diff)
Fix gitlab:import:repos Rake task moving repositories into the wrong location
If the source import directory were different from the destination directory, GitLab would first create a blank repository and then erroneously move the original one into a subdirectory. Adding an import type prevents this the project from being initialized in the first place. It was accidentally removed in 1f917cbd49. Closes #40765
Diffstat (limited to 'spec/lib/gitlab/bare_repository_import')
-rw-r--r--spec/lib/gitlab/bare_repository_import/importer_spec.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/spec/lib/gitlab/bare_repository_import/importer_spec.rb b/spec/lib/gitlab/bare_repository_import/importer_spec.rb
index 7f3bf5fc41c..dafec2b0033 100644
--- a/spec/lib/gitlab/bare_repository_import/importer_spec.rb
+++ b/spec/lib/gitlab/bare_repository_import/importer_spec.rb
@@ -132,6 +132,20 @@ describe Gitlab::BareRepositoryImport::Importer, repository: true do
expect(File).to exist(File.join(project.repository_storage_path, project.disk_path + '.git'))
end
+
+ it 'moves an existing project to the correct path' do
+ project = create(:project, :repository)
+ original_commit_count = project.repository.commit_count
+
+ bare_repo = Gitlab::BareRepositoryImport::Repository.new(project.repository_storage_path, project.repository.path)
+ gitlab_importer = described_class.new(admin, bare_repo)
+
+ expect(gitlab_importer).to receive(:create_project).and_call_original
+
+ new_project = gitlab_importer.create_project_if_needed
+
+ expect(new_project.repository.commit_count).to eq(original_commit_count)
+ end
end
context 'with Wiki' do