Commit be5e6d58 authored by Jacob Vosmaer's avatar Jacob Vosmaer

Make search and message RPC's mandatory

parent 1f31803d
...@@ -323,13 +323,7 @@ module Gitlab ...@@ -323,13 +323,7 @@ module Gitlab
end end
def get_messages(repository, commit_ids) def get_messages(repository, commit_ids)
repository.gitaly_migrate(:commit_messages) do |is_enabled| repository.gitaly_commit_client.get_commit_messages(commit_ids)
if is_enabled
repository.gitaly_commit_client.get_commit_messages(commit_ids)
else
commit_ids.map { |id| [id, rugged_find(repository, id).message] }.to_h
end
end
end end
end end
......
...@@ -1316,16 +1316,7 @@ module Gitlab ...@@ -1316,16 +1316,7 @@ module Gitlab
safe_query = Regexp.escape(query) safe_query = Regexp.escape(query)
ref ||= root_ref ref ||= root_ref
gitaly_migrate(:search_files_by_content) do |is_enabled| gitaly_repository_client.search_files_by_content(ref, safe_query)
if is_enabled
gitaly_repository_client.search_files_by_content(ref, safe_query)
else
offset = 2
args = %W(grep -i -I -n -z --before-context #{offset} --after-context #{offset} -E -e #{safe_query} #{ref})
run_git(args).first.scrub.split(/^--\n/)
end
end
end end
def can_be_merged?(source_sha, target_branch) def can_be_merged?(source_sha, target_branch)
...@@ -1342,15 +1333,7 @@ module Gitlab ...@@ -1342,15 +1333,7 @@ module Gitlab
return [] if empty? || safe_query.blank? return [] if empty? || safe_query.blank?
gitaly_migrate(:search_files_by_name) do |is_enabled| gitaly_repository_client.search_files_by_name(ref, safe_query)
if is_enabled
gitaly_repository_client.search_files_by_name(ref, safe_query)
else
args = %W(ls-tree -r --name-status --full-tree #{ref} -- #{safe_query})
run_git(args).first.lines.map(&:strip)
end
end
end end
def find_commits_by_message(query, ref, path, limit, offset) def find_commits_by_message(query, ref, path, limit, offset)
......
...@@ -28,18 +28,7 @@ module Gitlab ...@@ -28,18 +28,7 @@ module Gitlab
end end
def get_messages(repository, tag_ids) def get_messages(repository, tag_ids)
repository.gitaly_migrate(:tag_messages) do |is_enabled| repository.gitaly_ref_client.get_tag_messages(tag_ids)
if is_enabled
repository.gitaly_ref_client.get_tag_messages(tag_ids)
else
tag_ids.map do |id|
tag = repository.rugged.lookup(id)
message = tag.is_a?(Rugged::Commit) ? "" : tag.message
[id, message]
end.to_h
end
end
end end
end end
......
...@@ -664,7 +664,7 @@ describe Repository do ...@@ -664,7 +664,7 @@ describe Repository do
end end
end end
shared_examples "search_files_by_content" do describe "search_files_by_content" do
let(:results) { repository.search_files_by_content('feature', 'master') } let(:results) { repository.search_files_by_content('feature', 'master') }
subject { results } subject { results }
...@@ -711,7 +711,7 @@ describe Repository do ...@@ -711,7 +711,7 @@ describe Repository do
end end
end end
shared_examples "search_files_by_name" do describe "search_files_by_name" do
let(:results) { repository.search_files_by_name('files', 'master') } let(:results) { repository.search_files_by_name('files', 'master') }
it 'returns result' do it 'returns result' do
...@@ -751,16 +751,6 @@ describe Repository do ...@@ -751,16 +751,6 @@ describe Repository do
end end
end end
describe 'with gitaly enabled' do
it_behaves_like 'search_files_by_content'
it_behaves_like 'search_files_by_name'
end
describe 'with gitaly disabled', :disable_gitaly do
it_behaves_like 'search_files_by_content'
it_behaves_like 'search_files_by_name'
end
describe '#async_remove_remote' do describe '#async_remove_remote' do
before do before do
masterrev = repository.find_branch('master').dereferenced_target masterrev = repository.find_branch('master').dereferenced_target
......
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