Skip to content
Snippets Groups Projects
Commit 3a4ecfd0 authored by Jacob Vosmaer's avatar Jacob Vosmaer :wave: Committed by Sean McGivern
Browse files

Prevent Gitaly WriteConfig log noise

parent 40dc82f8
No related branches found
No related tags found
2 merge requests!6031Prepare 11.0 RC6 EE release,!5985CE upstream - 2018-06-05 21:46 UTC
This commit is part of merge request !6031. Comments created here will be created in the context of that merge request.
......@@ -1397,6 +1397,11 @@ def multi_action(
def write_config(full_path:)
return unless full_path.present?
# This guard avoids Gitaly log/error spam
unless exists?
raise NoRepository, 'repository does not exist'
end
gitaly_migrate(:write_config) do |is_enabled|
if is_enabled
gitaly_repository_client.write_config(full_path: full_path)
......
......@@ -2002,6 +2002,18 @@ def commit_files(commit)
expect(config).to include("fullpath = #{repository_path}")
end
end
context 'repository does not exist' do
it 'raises NoRepository and does not call Gitaly WriteConfig' do
repository = Gitlab::Git::Repository.new('default', 'does/not/exist.git', '')
expect(repository.gitaly_repository_client).not_to receive(:write_config)
expect do
repository.write_config(full_path: 'foo/bar.git')
end.to raise_error(Gitlab::Git::Repository::NoRepository)
end
end
end
context "when gitaly_write_config is enabled" do
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment