Commit 727f5fd5 authored by Robert Speicher's avatar Robert Speicher

Merge branch 'sh-import-repos-fix-9-5' into '9-5-stable'

Fix gitlab rake:import:repos task for 9.5.x

See merge request gitlab-org/gitlab-ce!14639
parents d62889dd 7ac4e2b2
......@@ -77,6 +77,7 @@ class Project < ActiveRecord::Base
attr_accessor :old_path_with_namespace
attr_accessor :template_name
attr_writer :pipeline_status
attr_accessor :skip_disk_validation
alias_attribute :title, :name
......@@ -993,6 +994,7 @@ class Project < ActiveRecord::Base
# Check if repository already exists on disk
def can_create_repository?
return true if skip_disk_validation
return false unless repository_storage_path
if gitlab_shell.exists?(repository_storage_path, "#{build_full_path}.git")
......
---
title: Fix gitlab rake:import:repos task
merge_request:
author:
......@@ -39,7 +39,8 @@ namespace :gitlab do
project_params = {
name: name,
path: name
path: name,
skip_disk_validation: true
}
# find group namespace
......
......@@ -1650,6 +1650,17 @@ describe Project do
end
end
describe '#can_create_repository?' do
let(:project) { build(:project) }
it 'skips gitlab-shell exists?' do
project.skip_disk_validation = true
expect(project.gitlab_shell).not_to receive(:exists?)
expect(project.can_create_repository?).to be_truthy
end
end
describe '#latest_successful_builds_for' do
def create_pipeline(status = 'success')
create(:ci_pipeline, project: project,
......
......@@ -208,6 +208,15 @@ describe Projects::CreateService, '#execute' do
end
end
context 'when skip_disk_validation is used' do
it 'sets the project attribute' do
opts[:skip_disk_validation] = true
project = create_project(user, opts)
expect(project.skip_disk_validation).to be_truthy
end
end
def create_project(user, opts)
Projects::CreateService.new(user, opts).execute
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment