Commit 29b4d657 authored by Zeger-Jan van de Weg's avatar Zeger-Jan van de Weg

Moves another RPC to mandatory

This specific one isn't used on most machines, therefor low risk.

Closes https://gitlab.com/gitlab-org/gitaly/issues/944
parent 901159bb
...@@ -21,7 +21,7 @@ class Repository ...@@ -21,7 +21,7 @@ class Repository
attr_accessor :full_path, :disk_path, :project, :is_wiki attr_accessor :full_path, :disk_path, :project, :is_wiki
delegate :ref_name_for_sha, to: :raw_repository delegate :ref_name_for_sha, to: :raw_repository
delegate :bundle_to_disk, :create_from_bundle, to: :raw_repository delegate :bundle_to_disk, to: :raw_repository
CreateTreeError = Class.new(StandardError) CreateTreeError = Class.new(StandardError)
......
...@@ -1158,16 +1158,7 @@ module Gitlab ...@@ -1158,16 +1158,7 @@ module Gitlab
end end
def create_from_bundle(bundle_path) def create_from_bundle(bundle_path)
gitaly_migrate(:create_repo_from_bundle) do |is_enabled|
if is_enabled
gitaly_repository_client.create_from_bundle(bundle_path) gitaly_repository_client.create_from_bundle(bundle_path)
else
run_git!(%W(clone --bare -- #{bundle_path} #{path}), chdir: nil)
self.class.create_hooks(path, File.expand_path(Gitlab.config.gitlab_shell.hooks_path))
end
end
true
end end
def create_from_snapshot(url, auth) def create_from_snapshot(url, auth)
......
...@@ -2160,13 +2160,12 @@ describe Gitlab::Git::Repository, seed_helper: true do ...@@ -2160,13 +2160,12 @@ describe Gitlab::Git::Repository, seed_helper: true do
end end
describe '#create_from_bundle' do describe '#create_from_bundle' do
shared_examples 'creating repo from bundle' do
let(:bundle_path) { File.join(Dir.tmpdir, "repo-#{SecureRandom.hex}.bundle") } let(:bundle_path) { File.join(Dir.tmpdir, "repo-#{SecureRandom.hex}.bundle") }
let(:project) { create(:project) } let(:project) { create(:project) }
let(:imported_repo) { project.repository.raw } let(:imported_repo) { project.repository.raw }
before do before do
expect(repository.bundle_to_disk(bundle_path)).to be true expect(repository.bundle_to_disk(bundle_path)).to be_truthy
end end
after do after do
...@@ -2178,7 +2177,7 @@ describe Gitlab::Git::Repository, seed_helper: true do ...@@ -2178,7 +2177,7 @@ describe Gitlab::Git::Repository, seed_helper: true do
result = imported_repo.create_from_bundle(bundle_path) result = imported_repo.create_from_bundle(bundle_path)
expect(result).to be true expect(result).to be_truthy
expect(imported_repo).to exist expect(imported_repo).to exist
expect { imported_repo.fsck }.not_to raise_exception expect { imported_repo.fsck }.not_to raise_exception
end end
...@@ -2191,15 +2190,6 @@ describe Gitlab::Git::Repository, seed_helper: true do ...@@ -2191,15 +2190,6 @@ describe Gitlab::Git::Repository, seed_helper: true do
end end
end end
context 'when Gitaly create_repo_from_bundle feature is enabled' do
it_behaves_like 'creating repo from bundle'
end
context 'when Gitaly create_repo_from_bundle feature is disabled', :disable_gitaly do
it_behaves_like 'creating repo from bundle'
end
end
describe '#checksum' do describe '#checksum' do
it 'calculates the checksum for non-empty repo' do it 'calculates the checksum for non-empty repo' do
expect(repository.checksum).to eq '4be7d24ce7e8d845502d599b72d567d23e6a40c0' expect(repository.checksum).to eq '4be7d24ce7e8d845502d599b72d567d23e6a40c0'
......
...@@ -30,7 +30,7 @@ describe Gitlab::ImportExport::RepoRestorer do ...@@ -30,7 +30,7 @@ describe Gitlab::ImportExport::RepoRestorer do
end end
it 'restores the repo successfully' do it 'restores the repo successfully' do
expect(restorer.restore).to be true expect(restorer.restore).to be_truthy
end end
it 'has the webhooks' do it 'has the webhooks' do
......
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