summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Cai <jcai@gitlab.com>2019-08-07 18:00:07 -0700
committerJohn Cai <jcai@gitlab.com>2019-08-07 18:08:25 -0700
commitb78919e5f48434bea738f651ae3ef85f45a4b181 (patch)
tree08f8b5a7545388d31034c97bec9657eab5ea8bfb
parentcb176f17c00c62da31449f66f2d98dd9f3c40d6c (diff)
downloadgitlab-ce-jc-deprecate-add-namespace.tar.gz
Do not check for repository existencejc-deprecate-add-namespace
-rw-r--r--app/models/project.rb8
-rw-r--r--app/services/projects/hashed_storage/migrate_repository_service.rb1
-rw-r--r--spec/services/projects/update_service_spec.rb2
3 files changed, 2 insertions, 9 deletions
diff --git a/app/models/project.rb b/app/models/project.rb
index f94cbdd75a4..1eed164f3e2 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -1322,7 +1322,7 @@ class Project < ApplicationRecord
# Check if repository with same path already exists on disk we can
# skip this for the hashed storage because the path does not change
- if legacy_storage? && repository_with_same_path_already_exists?
+ if legacy_storage?
errors.add(:base, _('There is already a repository with that name on disk'))
return false
end
@@ -2204,16 +2204,12 @@ class Project < ApplicationRecord
def check_repository_absence!
return if skip_disk_validation
- if repository_storage.blank? || repository_with_same_path_already_exists?
+ if repository_storage.blank?
errors.add(:base, _('There is already a repository with that name on disk'))
throw :abort
end
end
- def repository_with_same_path_already_exists?
- gitlab_shell.exists?(repository_storage, "#{disk_path}.git")
- end
-
def set_timestamps_for_create
update_columns(last_activity_at: self.created_at, last_repository_updated_at: self.created_at)
end
diff --git a/app/services/projects/hashed_storage/migrate_repository_service.rb b/app/services/projects/hashed_storage/migrate_repository_service.rb
index b50479f770e..e8393128d58 100644
--- a/app/services/projects/hashed_storage/migrate_repository_service.rb
+++ b/app/services/projects/hashed_storage/migrate_repository_service.rb
@@ -27,7 +27,6 @@ module Projects
end
project.repository_read_only = false
-
project.save!(validate: false)
if result && block_given?
diff --git a/spec/services/projects/update_service_spec.rb b/spec/services/projects/update_service_spec.rb
index 6bbaa410d56..366c6674e9b 100644
--- a/spec/services/projects/update_service_spec.rb
+++ b/spec/services/projects/update_service_spec.rb
@@ -304,8 +304,6 @@ describe Projects::UpdateService do
end
it 'does not check if new path matches existing repository on disk' do
- expect(project).not_to receive(:repository_with_same_path_already_exists?)
-
result = update_project(project, admin, path: 'existing')
expect(result).to include(status: :success)